package net.minecraft.client.particle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityEnchantmentTableParticleFX extends EntityFX
{
private float field_70565_a;
private double field_70568_aq;
private double field_70567_ar;
private double field_70566_as;
private static final String __OBFID = "CL_00000902";
public EntityEnchantmentTableParticleFX(World p_i1204_1_, double p_i1204_2_, double p_i1204_4_, double p_i1204_6_, double p_i1204_8_, double p_i1204_10_, double p_i1204_12_)
{
super(p_i1204_1_, p_i1204_2_, p_i1204_4_, p_i1204_6_, p_i1204_8_, p_i1204_10_, p_i1204_12_);
this.motionX = p_i1204_8_;
this.motionY = p_i1204_10_;
this.motionZ = p_i1204_12_;
this.field_70568_aq = this.posX = p_i1204_2_;
this.field_70567_ar = this.posY = p_i1204_4_;
this.field_70566_as = this.posZ = p_i1204_6_;
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.field_70565_a = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f;
this.particleGreen *= 0.9F;
this.particleRed *= 0.9F;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 30;
this.noClip = true;
this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D));
}
public int getBrightnessForRender(float p_70070_1_)
{
int i = super.getBrightnessForRender(p_70070_1_);
float f1 = (float)this.particleAge / (float)this.particleMaxAge;
f1 *= f1;
f1 *= f1;
int j = i & 255;
int k = i >> 16 & 255;
k += (int)(f1 * 15.0F * 16.0F);
if (k > 240)
{
k = 240;
}
return j | k << 16;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float p_70013_1_)
{
float f1 = super.getBrightness(p_70013_1_);
float f2 = (float)this.particleAge / (float)this.particleMaxAge;
f2 *= f2;
f2 *= f2;
return f1 * (1.0F - f2) + f2;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = 1.0F - f;
float f1 = 1.0F - f;
f1 *= f1;
f1 *= f1;
this.posX = this.field_70568_aq + this.motionX * (double)f;
this.posY = this.field_70567_ar + this.motionY * (double)f - (double)(f1 * 1.2F);
this.posZ = this.field_70566_as + this.motionZ * (double)f;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
}
}