    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 EntityCritFX extends EntityFX
    008    {
    009        float field_70561_a;
    010
    011        public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
    012        {
    013            this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
    014        }
    015
    016        public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14)
    017        {
    018            super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
    019            this.motionX *= 0.10000000149011612D;
    020            this.motionY *= 0.10000000149011612D;
    021            this.motionZ *= 0.10000000149011612D;
    022            this.motionX += par8 * 0.4D;
    023            this.motionY += par10 * 0.4D;
    024            this.motionZ += par12 * 0.4D;
    025            this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
    026            this.particleScale *= 0.75F;
    027            this.particleScale *= par14;
    028            this.field_70561_a = this.particleScale;
    029            this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
    030            this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
    031            this.noClip = false;
    032            this.setParticleTextureIndex(65);
    033            this.onUpdate();
    034        }
    035
    036        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    037        {
    038            float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F;
    039
    040            if (var8 < 0.0F)
    041            {
    042                var8 = 0.0F;
    043            }
    044
    045            if (var8 > 1.0F)
    046            {
    047                var8 = 1.0F;
    048            }
    049
    050            this.particleScale = this.field_70561_a * var8;
    051            super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
    052        }
    053
    054        /**
    055         * Called to update the entity's position/logic.
    056         */
    057        public void onUpdate()
    058        {
    059            this.prevPosX = this.posX;
    060            this.prevPosY = this.posY;
    061            this.prevPosZ = this.posZ;
    062
    063            if (this.particleAge++ >= this.particleMaxAge)
    064            {
    065                this.setDead();
    066            }
    067
    068            this.moveEntity(this.motionX, this.motionY, this.motionZ);
    069            this.particleGreen = (float)((double)this.particleGreen * 0.96D);
    070            this.particleBlue = (float)((double)this.particleBlue * 0.9D);
    071            this.motionX *= 0.699999988079071D;
    072            this.motionY *= 0.699999988079071D;
    073            this.motionZ *= 0.699999988079071D;
    074            this.motionY -= 0.019999999552965164D;
    075
    076            if (this.onGround)
    077            {
    078                this.motionX *= 0.699999988079071D;
    079                this.motionZ *= 0.699999988079071D;
    080            }
    081        }
    082    }