package client.renderer.entity;

import org.lwjgl.opengl.GL11;

import client.renderer.model.ModelBase;
import client.renderer.model.ModelCrystal;
import common.entity.item.EntityCrystal;
import common.util.ExtMath;


public class RenderCrystal extends Render<EntityCrystal>
{
    private static final String crystalTextures = "textures/object/crystal.png";
    
    private ModelBase modelCrystal = new ModelCrystal(0.0F, false);

    public RenderCrystal(RenderManager renderManagerIn)
    {
        super(renderManagerIn);
//        this.shadowSize = 0.5F;
    }

    /**
     * Renders the desired {@code T} type Entity.
     */
    public void doRender(EntityCrystal entity, double x, double y, double z, float partialTicks)
    {
        float f = (float)entity.innerRotation + partialTicks;
        GL11.glPushMatrix();
        GL11.glTranslatef((float)x, (float)y, (float)z);
        this.bindTexture(crystalTextures);
        float f1 = ExtMath.sin(f * 0.2F) / 2.0F + 0.5F;
        f1 = f1 * f1 + f1;
        this.modelCrystal.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
        super.doRender(entity, x, y, z, partialTicks);
    }

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