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