    001package net.minecraft.client.particle;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.renderer.RenderEngine;
    006import net.minecraft.client.renderer.Tessellator;
    007import net.minecraft.util.MathHelper;
    008import net.minecraft.world.World;
    009import org.lwjgl.opengl.GL11;
    010
    011@SideOnly(Side.CLIENT)
    012public 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 f6 = ((float)this.field_70576_a + par2) / (float)this.field_70578_aq;
    029        f6 *= f6;
    030        float f7 = 2.0F - f6 * 2.0F;
    031
    032        if (f7 > 1.0F)
    033        {
    034            f7 = 1.0F;
    035        }
    036
    037        f7 *= 0.2F;
    038        GL11.glDisable(GL11.GL_LIGHTING);
    039        float f8 = 0.125F;
    040        float f9 = (float)(this.posX - interpPosX);
    041        float f10 = (float)(this.posY - interpPosY);
    042        float f11 = (float)(this.posZ - interpPosZ);
    043        float f12 = this.worldObj.getLightBrightness(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));
    044        this.currentFootSteps.func_98187_b("/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(f12, f12, f12, f7);
    049        par1Tessellator.addVertexWithUV((double)(f9 - f8), (double)f10, (double)(f11 + f8), 0.0D, 1.0D);
    050        par1Tessellator.addVertexWithUV((double)(f9 + f8), (double)f10, (double)(f11 + f8), 1.0D, 1.0D);
    051        par1Tessellator.addVertexWithUV((double)(f9 + f8), (double)f10, (double)(f11 - f8), 1.0D, 0.0D);
    052        par1Tessellator.addVertexWithUV((double)(f9 - f8), (double)f10, (double)(f11 - f8), 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}