    001    package net.minecraft.client.particle;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import net.minecraft.block.Block;
    006    import net.minecraft.client.renderer.Tessellator;
    007    import net.minecraft.world.World;
    008
    009    @SideOnly(Side.CLIENT)
    010    public class EntityDiggingFX extends EntityFX
    011    {
    012        private Block blockInstance;
    013        private int side;
    014
    015        public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16)
    016        {
    017            super(par1World, par2, par4, par6, par8, par10, par12);
    018            this.blockInstance = par14Block;
    019            this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(par15, par16));
    020            this.particleGravity = par14Block.blockParticleGravity;
    021            this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
    022            this.particleScale /= 2.0F;
    023            this.side = par15;
    024        }
    025
    026        public EntityDiggingFX func_70596_a(int par1, int par2, int par3)
    027        {
    028            if (this.blockInstance == Block.grass && this.side != 1)
    029            {
    030                return this;
    031            }
    032            else
    033            {
    034                int var4 = this.blockInstance.colorMultiplier(this.worldObj, par1, par2, par3);
    035                this.particleRed *= (float)(var4 >> 16 & 255) / 255.0F;
    036                this.particleGreen *= (float)(var4 >> 8 & 255) / 255.0F;
    037                this.particleBlue *= (float)(var4 & 255) / 255.0F;
    038                return this;
    039            }
    040        }
    041
    042        public EntityDiggingFX func_90019_g(int par1)
    043        {
    044            if (this.blockInstance == Block.grass)
    045            {
    046                return this;
    047            }
    048            else
    049            {
    050                int var2 = this.blockInstance.getRenderColor(par1);
    051                this.particleRed *= (float)(var2 >> 16 & 255) / 255.0F;
    052                this.particleGreen *= (float)(var2 >> 8 & 255) / 255.0F;
    053                this.particleBlue *= (float)(var2 & 255) / 255.0F;
    054                return this;
    055            }
    056        }
    057
    058        public int getFXLayer()
    059        {
    060            return 1;
    061        }
    062
    063        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    064        {
    065            float var8 = ((float)(this.getParticleTextureIndex() % 16) + this.particleTextureJitterX / 4.0F) / 16.0F;
    066            float var9 = var8 + 0.015609375F;
    067            float var10 = ((float)(this.getParticleTextureIndex() / 16) + this.particleTextureJitterY / 4.0F) / 16.0F;
    068            float var11 = var10 + 0.015609375F;
    069            float var12 = 0.1F * this.particleScale;
    070            float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    071            float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    072            float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    073            float var16 = 1.0F;
    074            par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue);
    075            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11);
    076            par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10);
    077            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10);
    078            par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11);
    079        }
    080    }