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 EntityCrit2FX extends EntityFX 008 { 009 /** Entity that had been hit and done the Critical hit on. */ 010 private Entity theEntity; 011 private int currentLife; 012 private int maximumLife; 013 private String particleName; 014 015 public EntityCrit2FX(World par1World, Entity par2Entity) 016 { 017 this(par1World, par2Entity, "crit"); 018 } 019 020 public EntityCrit2FX(World par1World, Entity par2Entity, String par3Str) 021 { 022 super(par1World, par2Entity.posX, par2Entity.boundingBox.minY + (double)(par2Entity.height / 2.0F), par2Entity.posZ, par2Entity.motionX, par2Entity.motionY, par2Entity.motionZ); 023 this.currentLife = 0; 024 this.maximumLife = 0; 025 this.theEntity = par2Entity; 026 this.maximumLife = 3; 027 this.particleName = par3Str; 028 this.onUpdate(); 029 } 030 031 public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {} 032 033 /** 034 * Called to update the entity's position/logic. 035 */ 036 public void onUpdate() 037 { 038 for (int var1 = 0; var1 < 16; ++var1) 039 { 040 double var2 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); 041 double var4 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); 042 double var6 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); 043 044 if (var2 * var2 + var4 * var4 + var6 * var6 <= 1.0D) 045 { 046 double var8 = this.theEntity.posX + var2 * (double)this.theEntity.width / 4.0D; 047 double var10 = this.theEntity.boundingBox.minY + (double)(this.theEntity.height / 2.0F) + var4 * (double)this.theEntity.height / 4.0D; 048 double var12 = this.theEntity.posZ + var6 * (double)this.theEntity.width / 4.0D; 049 this.worldObj.spawnParticle(this.particleName, var8, var10, var12, var2, var4 + 0.2D, var6); 050 } 051 } 052 053 ++this.currentLife; 054 055 if (this.currentLife >= this.maximumLife) 056 { 057 this.setDead(); 058 } 059 } 060 061 public int getFXLayer() 062 { 063 return 3; 064 } 065 }