    001    package net.minecraft.client.particle;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import net.minecraft.world.World;
    006
    007    @SideOnly(Side.CLIENT)
    008    public class EntityEnchantmentTableParticleFX extends EntityFX
    009    {
    010        private float field_70565_a;
    011        private double field_70568_aq;
    012        private double field_70567_ar;
    013        private double field_70566_as;
    014
    015        public EntityEnchantmentTableParticleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
    016        {
    017            super(par1World, par2, par4, par6, par8, par10, par12);
    018            this.motionX = par8;
    019            this.motionY = par10;
    020            this.motionZ = par12;
    021            this.field_70568_aq = this.posX = par2;
    022            this.field_70567_ar = this.posY = par4;
    023            this.field_70566_as = this.posZ = par6;
    024            float var14 = this.rand.nextFloat() * 0.6F + 0.4F;
    025            this.field_70565_a = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F;
    026            this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;
    027            this.particleGreen *= 0.9F;
    028            this.particleRed *= 0.9F;
    029            this.particleMaxAge = (int)(Math.random() * 10.0D) + 30;
    030            this.noClip = true;
    031            this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D));
    032        }
    033
    034        public int getBrightnessForRender(float par1)
    035        {
    036            int var2 = super.getBrightnessForRender(par1);
    037            float var3 = (float)this.particleAge / (float)this.particleMaxAge;
    038            var3 *= var3;
    039            var3 *= var3;
    040            int var4 = var2 & 255;
    041            int var5 = var2 >> 16 & 255;
    042            var5 += (int)(var3 * 15.0F * 16.0F);
    043
    044            if (var5 > 240)
    045            {
    046                var5 = 240;
    047            }
    048
    049            return var4 | var5 << 16;
    050        }
    051
    052        /**
    053         * Gets how bright this entity is.
    054         */
    055        public float getBrightness(float par1)
    056        {
    057            float var2 = super.getBrightness(par1);
    058            float var3 = (float)this.particleAge / (float)this.particleMaxAge;
    059            var3 *= var3;
    060            var3 *= var3;
    061            return var2 * (1.0F - var3) + var3;
    062        }
    063
    064        /**
    065         * Called to update the entity's position/logic.
    066         */
    067        public void onUpdate()
    068        {
    069            this.prevPosX = this.posX;
    070            this.prevPosY = this.posY;
    071            this.prevPosZ = this.posZ;
    072            float var1 = (float)this.particleAge / (float)this.particleMaxAge;
    073            var1 = 1.0F - var1;
    074            float var2 = 1.0F - var1;
    075            var2 *= var2;
    076            var2 *= var2;
    077            this.posX = this.field_70568_aq + this.motionX * (double)var1;
    078            this.posY = this.field_70567_ar + this.motionY * (double)var1 - (double)(var2 * 1.2F);
    079            this.posZ = this.field_70566_as + this.motionZ * (double)var1;
    080
    081            if (this.particleAge++ >= this.particleMaxAge)
    082            {
    083                this.setDead();
    084            }
    085        }
    086    }