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