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