    001package net.minecraft.client.particle;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.block.Block;
    006import net.minecraft.client.renderer.Tessellator;
    007import net.minecraft.item.Item;
    008import net.minecraft.world.World;
    009
    010@SideOnly(Side.CLIENT)
    011public class EntityBreakingFX extends EntityFX
    012{
    013    public EntityBreakingFX(World par1World, double par2, double par4, double par6, Item par8Item)
    014    {
    015        super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
    016        this.setParticleTextureIndex(par8Item.getIconFromDamage(0));
    017        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
    018        this.particleGravity = Block.blockSnow.blockParticleGravity;
    019        this.particleScale /= 2.0F;
    020    }
    021
    022    public EntityBreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item)
    023    {
    024        this(par1World, par2, par4, par6, par14Item);
    025        this.motionX *= 0.10000000149011612D;
    026        this.motionY *= 0.10000000149011612D;
    027        this.motionZ *= 0.10000000149011612D;
    028        this.motionX += par8;
    029        this.motionY += par10;
    030        this.motionZ += par12;
    031    }
    032
    033    public int getFXLayer()
    034    {
    035        return 2;
    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.getParticleTextureIndex() % 16) + this.particleTextureJitterX / 4.0F) / 16.0F;
    041        float var9 = var8 + 0.015609375F;
    042        float var10 = ((float)(this.getParticleTextureIndex() / 16) + this.particleTextureJitterY / 4.0F) / 16.0F;
    043        float var11 = var10 + 0.015609375F;
    044        float var12 = 0.1F * this.particleScale;
    045        float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    046        float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    047        float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    048        float var16 = 1.0F;
    049        par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue);
    050        par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11);
    051        par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10);
    052        par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10);
    053        par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11);
    054    }
    055}