package client.renderer.entity;

import org.lwjgl.opengl.GL11;

import client.renderer.model.ModelBat;
import common.entity.animal.EntityBat;
import common.util.ExtMath;


public class RenderBat extends RenderLiving<EntityBat>
{
    private static final String batTextures = "textures/creature/bat.png";

    public RenderBat(RenderManager renderManagerIn)
    {
        super(renderManagerIn, new ModelBat());
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected String getEntityTexture(EntityBat entity)
    {
        return batTextures;
    }

    /**
     * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
     * entityLiving, partialTickTime
     */
    protected void preRenderCallback(EntityBat entitylivingbaseIn, float partialTickTime)
    {
        GL11.glScalef(0.35F, 0.35F, 0.35F);
    }

    protected void rotateCorpse(EntityBat bat, float p_77043_2_, float p_77043_3_, float partialTicks)
    {
        if (!bat.getIsBatHanging())
        {
            GL11.glTranslatef(0.0F, ExtMath.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F);
        }
        else
        {
            GL11.glTranslatef(0.0F, -0.1F, 0.0F);
        }

        super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks);
    }
}
