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