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