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 EntityExplodeFX extends EntityFX
008    {
009        public EntityExplodeFX(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.motionX = par8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
013            this.motionY = par10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
014            this.motionZ = par12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
015            this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F;
016            this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
017            this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
018        }
019    
020        /**
021         * Called to update the entity's position/logic.
022         */
023        public void onUpdate()
024        {
025            this.prevPosX = this.posX;
026            this.prevPosY = this.posY;
027            this.prevPosZ = this.posZ;
028    
029            if (this.particleAge++ >= this.particleMaxAge)
030            {
031                this.setDead();
032            }
033    
034            this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
035            this.motionY += 0.004D;
036            this.moveEntity(this.motionX, this.motionY, this.motionZ);
037            this.motionX *= 0.8999999761581421D;
038            this.motionY *= 0.8999999761581421D;
039            this.motionZ *= 0.8999999761581421D;
040    
041            if (this.onGround)
042            {
043                this.motionX *= 0.699999988079071D;
044                this.motionZ *= 0.699999988079071D;
045            }
046        }
047    }