    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 EntityDiggingFX extends EntityFX
    008    {
    009        private Block blockInstance;
    010        private int side;
    011
    012        public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16)
    013        {
    014            super(par1World, par2, par4, par6, par8, par10, par12);
    015            this.blockInstance = par14Block;
    016            this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(par15, par16));
    017            this.particleGravity = par14Block.blockParticleGravity;
    018            this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
    019            this.particleScale /= 2.0F;
    020            this.side = par15;
    021        }
    022
    023        public EntityDiggingFX func_70596_a(int par1, int par2, int par3)
    024        {
    025            if (this.blockInstance == Block.grass && this.side != 1)
    026            {
    027                return this;
    028            }
    029            else
    030            {
    031                int var4 = this.blockInstance.colorMultiplier(this.worldObj, par1, par2, par3);
    032                this.particleRed *= (float)(var4 >> 16 & 255) / 255.0F;
    033                this.particleGreen *= (float)(var4 >> 8 & 255) / 255.0F;
    034                this.particleBlue *= (float)(var4 & 255) / 255.0F;
    035                return this;
    036            }
    037        }
    038
    039        public int getFXLayer()
    040        {
    041            return 1;
    042        }
    043
    044        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    045        {
    046            float var8 = ((float)(this.getParticleTextureIndex() % 16) + this.particleTextureJitterX / 4.0F) / 16.0F;
    047            float var9 = var8 + 0.015609375F;
    048            float var10 = ((float)(this.getParticleTextureIndex() / 16) + this.particleTextureJitterY / 4.0F) / 16.0F;
    049            float var11 = var10 + 0.015609375F;
    050            float var12 = 0.1F * this.particleScale;
    051            float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    052            float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    053            float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    054            float var16 = 1.0F;
    055            par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue);
    056            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11);
    057            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10);
    058            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10);
    059            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11);
    060        }
    061    }