    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.client.renderer.RenderEngine;
    006    import net.minecraft.client.renderer.Tessellator;
    007    import net.minecraft.util.MathHelper;
    008    import net.minecraft.world.World;
    009    import org.lwjgl.opengl.GL11;
    010
    011    @SideOnly(Side.CLIENT)
    012    public class EntityFootStepFX extends EntityFX
    013    {
    014        private int field_70576_a = 0;
    015        private int field_70578_aq = 0;
    016        private RenderEngine currentFootSteps;
    017
    018        public EntityFootStepFX(RenderEngine par1RenderEngine, World par2World, double par3, double par5, double par7)
    019        {
    020            super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D);
    021            this.currentFootSteps = par1RenderEngine;
    022            this.motionX = this.motionY = this.motionZ = 0.0D;
    023            this.field_70578_aq = 200;
    024        }
    025
    026        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    027        {
    028            float var8 = ((float)this.field_70576_a + par2) / (float)this.field_70578_aq;
    029            var8 *= var8;
    030            float var9 = 2.0F - var8 * 2.0F;
    031
    032            if (var9 > 1.0F)
    033            {
    034                var9 = 1.0F;
    035            }
    036
    037            var9 *= 0.2F;
    038            GL11.glDisable(GL11.GL_LIGHTING);
    039            float var10 = 0.125F;
    040            float var11 = (float)(this.posX - interpPosX);
    041            float var12 = (float)(this.posY - interpPosY);
    042            float var13 = (float)(this.posZ - interpPosZ);
    043            float var14 = this.worldObj.getLightBrightness(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));
    044            this.currentFootSteps.bindTexture(this.currentFootSteps.getTexture("/misc/footprint.png"));
    045            GL11.glEnable(GL11.GL_BLEND);
    046            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    047            par1Tessellator.startDrawingQuads();
    048            par1Tessellator.setColorRGBA_F(var14, var14, var14, var9);
    049            par1Tessellator.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 + var10), 0.0D, 1.0D);
    050            par1Tessellator.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 + var10), 1.0D, 1.0D);
    051            par1Tessellator.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 - var10), 1.0D, 0.0D);
    052            par1Tessellator.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 - var10), 0.0D, 0.0D);
    053            par1Tessellator.draw();
    054            GL11.glDisable(GL11.GL_BLEND);
    055            GL11.glEnable(GL11.GL_LIGHTING);
    056        }
    057
    058        /**
    059         * Called to update the entity's position/logic.
    060         */
    061        public void onUpdate()
    062        {
    063            ++this.field_70576_a;
    064
    065            if (this.field_70576_a == this.field_70578_aq)
    066            {
    067                this.setDead();
    068            }
    069        }
    070
    071        public int getFXLayer()
    072        {
    073            return 3;
    074        }
    075    }