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