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.client.renderer.Tessellator;
006    import net.minecraft.entity.player.EntityPlayer;
007    import net.minecraft.world.World;
008    
009    @SideOnly(Side.CLIENT)
010    public class EntityCloudFX extends EntityFX
011    {
012        float field_70569_a;
013    
014        public EntityCloudFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
015        {
016            super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
017            float var14 = 2.5F;
018            this.motionX *= 0.10000000149011612D;
019            this.motionY *= 0.10000000149011612D;
020            this.motionZ *= 0.10000000149011612D;
021            this.motionX += par8;
022            this.motionY += par10;
023            this.motionZ += par12;
024            this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D);
025            this.particleScale *= 0.75F;
026            this.particleScale *= var14;
027            this.field_70569_a = this.particleScale;
028            this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D));
029            this.particleMaxAge = (int)((float)this.particleMaxAge * var14);
030            this.noClip = false;
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.field_70569_a * 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
066            this.moveEntity(this.motionX, this.motionY, this.motionZ);
067            this.motionX *= 0.9599999785423279D;
068            this.motionY *= 0.9599999785423279D;
069            this.motionZ *= 0.9599999785423279D;
070            EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 2.0D);
071    
072            if (var1 != null && this.posY > var1.boundingBox.minY)
073            {
074                this.posY += (var1.boundingBox.minY - this.posY) * 0.2D;
075                this.motionY += (var1.motionY - this.motionY) * 0.2D;
076                this.setPosition(this.posX, this.posY, this.posZ);
077            }
078    
079            if (this.onGround)
080            {
081                this.motionX *= 0.699999988079071D;
082                this.motionZ *= 0.699999988079071D;
083            }
084        }
085    }