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