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