package net.minecraft.src;

import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.EaglerAdapter;

public class RenderSheep extends RenderLiving
{
    private static final TextureLocation sheepTextures = new TextureLocation("textures/entity/sheep/sheep_fur.png");
    private static final TextureLocation shearedSheepTextures = new TextureLocation("textures/entity/sheep/sheep.png");

    public RenderSheep(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
    {
        super(par1ModelBase, par3);
        this.setRenderPassModel(par2ModelBase);
    }

    protected int setWoolColorAndRender(EntitySheep par1EntitySheep, int par2, float par3)
    {
        if (par2 == 0 && !par1EntitySheep.getSheared())
        {
            this.bindTexture(sheepTextures);
            float var4 = 1.0F;
            int var5 = par1EntitySheep.getFleeceColor();
            EaglerAdapter.glColor3f(var4 * EntitySheep.fleeceColorTable[var5][0], var4 * EntitySheep.fleeceColorTable[var5][1], var4 * EntitySheep.fleeceColorTable[var5][2]);
            return 1;
        }
        else
        {
            return -1;
        }
    }

    protected TextureLocation func_110883_a(EntitySheep par1EntitySheep)
    {
        return shearedSheepTextures;
    }

    @Override
    protected void bindTexture(EntityLivingBase par1EntityLiving) {
        shearedSheepTextures.bindTexture();
    }

    /**
     * Queries whether should render the specified pass or not.
     */
    protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
    {
        return this.setWoolColorAndRender((EntitySheep)par1EntityLivingBase, par2, par3);
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected TextureLocation getEntityTexture(Entity par1Entity)
    {
        return this.func_110883_a((EntitySheep)par1Entity);
    }
}
