    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.RenderEngine;
    007import net.minecraft.client.renderer.Tessellator;
    008import net.minecraft.item.Item;
    009import net.minecraft.world.World;
    010
    011@SideOnly(Side.CLIENT)
    012public class EntityBreakingFX extends EntityFX
    013{
    014    public EntityBreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, RenderEngine par9RenderEngine)
    015    {
    016        super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
    017        this.setParticleIcon(par9RenderEngine, par8Item.getIconFromDamage(0));
    018        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
    019        this.particleGravity = Block.blockSnow.blockParticleGravity;
    020        this.particleScale /= 2.0F;
    021    }
    022
    023    public EntityBreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item, RenderEngine par15RenderEngine)
    024    {
    025        this(par1World, par2, par4, par6, par14Item, par15RenderEngine);
    026        this.motionX *= 0.10000000149011612D;
    027        this.motionY *= 0.10000000149011612D;
    028        this.motionZ *= 0.10000000149011612D;
    029        this.motionX += par8;
    030        this.motionY += par10;
    031        this.motionZ += par12;
    032    }
    033
    034    public int getFXLayer()
    035    {
    036        return 2;
    037    }
    038
    039    public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    040    {
    041        float f6 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
    042        float f7 = f6 + 0.015609375F;
    043        float f8 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
    044        float f9 = f8 + 0.015609375F;
    045        float f10 = 0.1F * this.particleScale;
    046
    047        if (this.particleTextureIndex != null)
    048        {
    049            f6 = this.particleTextureIndex.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
    050            f7 = this.particleTextureIndex.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
    051            f8 = this.particleTextureIndex.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
    052            f9 = this.particleTextureIndex.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
    053        }
    054
    055        float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    056        float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    057        float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    058        float f14 = 1.0F;
    059        par1Tessellator.setColorOpaque_F(f14 * this.particleRed, f14 * this.particleGreen, f14 * this.particleBlue);
    060        par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f6, (double)f9);
    061        par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f6, (double)f8);
    062        par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f7, (double)f8);
    063        par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f7, (double)f9);
    064    }
    065}