    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 EntityDiggingFX func_90019_g(int par1)
    040        {
    041            if (this.blockInstance == Block.grass)
    042            {
    043                return this;
    044            }
    045            else
    046            {
    047                int var2 = this.blockInstance.getRenderColor(par1);
    048                this.particleRed *= (float)(var2 >> 16 & 255) / 255.0F;
    049                this.particleGreen *= (float)(var2 >> 8 & 255) / 255.0F;
    050                this.particleBlue *= (float)(var2 & 255) / 255.0F;
    051                return this;
    052            }
    053        }
    054
    055        public int getFXLayer()
    056        {
    057            return 1;
    058        }
    059
    060        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    061        {
    062            float var8 = ((float)(this.getParticleTextureIndex() % 16) + this.particleTextureJitterX / 4.0F) / 16.0F;
    063            float var9 = var8 + 0.015609375F;
    064            float var10 = ((float)(this.getParticleTextureIndex() / 16) + this.particleTextureJitterY / 4.0F) / 16.0F;
    065            float var11 = var10 + 0.015609375F;
    066            float var12 = 0.1F * this.particleScale;
    067            float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    068            float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    069            float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    070            float var16 = 1.0F;
    071            par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue);
    072            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11);
    073            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10);
    074            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10);
    075            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11);
    076        }
    077    }