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