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 EntityCloudFX extends EntityFX 008 { 009 float field_70569_a; 010 011 public EntityCloudFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) 012 { 013 super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); 014 float var14 = 2.5F; 015 this.motionX *= 0.10000000149011612D; 016 this.motionY *= 0.10000000149011612D; 017 this.motionZ *= 0.10000000149011612D; 018 this.motionX += par8; 019 this.motionY += par10; 020 this.motionZ += par12; 021 this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D); 022 this.particleScale *= 0.75F; 023 this.particleScale *= var14; 024 this.field_70569_a = this.particleScale; 025 this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D)); 026 this.particleMaxAge = (int)((float)this.particleMaxAge * var14); 027 this.noClip = false; 028 } 029 030 public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) 031 { 032 float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; 033 034 if (var8 < 0.0F) 035 { 036 var8 = 0.0F; 037 } 038 039 if (var8 > 1.0F) 040 { 041 var8 = 1.0F; 042 } 043 044 this.particleScale = this.field_70569_a * var8; 045 super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); 046 } 047 048 /** 049 * Called to update the entity's position/logic. 050 */ 051 public void onUpdate() 052 { 053 this.prevPosX = this.posX; 054 this.prevPosY = this.posY; 055 this.prevPosZ = this.posZ; 056 057 if (this.particleAge++ >= this.particleMaxAge) 058 { 059 this.setDead(); 060 } 061 062 this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); 063 this.moveEntity(this.motionX, this.motionY, this.motionZ); 064 this.motionX *= 0.9599999785423279D; 065 this.motionY *= 0.9599999785423279D; 066 this.motionZ *= 0.9599999785423279D; 067 EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 2.0D); 068 069 if (var1 != null && this.posY > var1.boundingBox.minY) 070 { 071 this.posY += (var1.boundingBox.minY - this.posY) * 0.2D; 072 this.motionY += (var1.motionY - this.motionY) * 0.2D; 073 this.setPosition(this.posX, this.posY, this.posZ); 074 } 075 076 if (this.onGround) 077 { 078 this.motionX *= 0.699999988079071D; 079 this.motionZ *= 0.699999988079071D; 080 } 081 } 082 }