001 package net.minecraft.src; 002 003 import cpw.mods.fml.common.Side; 004 import cpw.mods.fml.common.asm.SideOnly; 005 006 @SideOnly(Side.CLIENT) 007 public class EntityBubbleFX extends EntityFX 008 { 009 public EntityBubbleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) 010 { 011 super(par1World, par2, par4, par6, par8, par10, par12); 012 this.particleRed = 1.0F; 013 this.particleGreen = 1.0F; 014 this.particleBlue = 1.0F; 015 this.setParticleTextureIndex(32); 016 this.setSize(0.02F, 0.02F); 017 this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; 018 this.motionX = par8 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); 019 this.motionY = par10 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); 020 this.motionZ = par12 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); 021 this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); 022 } 023 024 /** 025 * Called to update the entity's position/logic. 026 */ 027 public void onUpdate() 028 { 029 this.prevPosX = this.posX; 030 this.prevPosY = this.posY; 031 this.prevPosZ = this.posZ; 032 this.motionY += 0.002D; 033 this.moveEntity(this.motionX, this.motionY, this.motionZ); 034 this.motionX *= 0.8500000238418579D; 035 this.motionY *= 0.8500000238418579D; 036 this.motionZ *= 0.8500000238418579D; 037 038 if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) != Material.water) 039 { 040 this.setDead(); 041 } 042 043 if (this.particleMaxAge-- <= 0) 044 { 045 this.setDead(); 046 } 047 } 048 }