package mods.manarz.entity.renders;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.manarz.entity.EntityJellyfish;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import org.lwjgl.opengl.GL11;


@SideOnly(Side.CLIENT)
public class RenderJellyfish extends RenderLiving
{
    public RenderJellyfish(ModelBase par1ModelBase, float par2)
    {
        super(par1ModelBase, par2);
    }

    /**
     * Renders the Living Squid.
     */
    public void renderLivingSquid(EntityJellyfish par1EntityJellyfish, double par2, double par4, double par6, float par8, float par9)
    {
//        super.doRenderLiving(par1EntityJellyfish, par2, par4, par6, par8, par9);
    }

    /**
     * Rotates the Squid's corpse.
     */
    protected void rotateSquidsCorpse(EntityJellyfish par1EntityJellyfish, float par2, float par3, float par4)
    {
        float f3 = par1EntityJellyfish.field_70862_e + (par1EntityJellyfish.field_70861_d - par1EntityJellyfish.field_70862_e) * par4;
        float f4 = par1EntityJellyfish.field_70860_g + (par1EntityJellyfish.field_70859_f - par1EntityJellyfish.field_70860_g) * par4;
        GL11.glTranslatef(0.0F, 0.5F, 0.0F);
        GL11.glRotatef(180.0F - par3, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(f3, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(f4, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(0.0F, -1.2F, 0.0F);
    }

    protected float handleRotationFloat(EntityJellyfish par1EntityJellyfish, float par2)
    {
        return par1EntityJellyfish.lastTentacleAngle + (par1EntityJellyfish.tentacleAngle - par1EntityJellyfish.lastTentacleAngle) * par2;
    }

    /**
     * Defines what float the third param in setRotationAngles of ModelBase is
     */
    protected float handleRotationFloat(EntityLiving par1EntityLiving, float par2)
    {
        return this.handleRotationFloat((EntityJellyfish)par1EntityLiving, par2);
    }

    protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    {
        this.rotateSquidsCorpse((EntityJellyfish)par1EntityLiving, par2, par3, par4);
    }

    public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    {
        this.renderLivingSquid((EntityJellyfish)par1EntityLiving, par2, par4, par6, par8, par9);
    }

    /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
        this.renderLivingSquid((EntityJellyfish)par1Entity, par2, par4, par6, par8, par9);
    }

	@Override
	protected ResourceLocation getEntityTexture(Entity entity) {
		return new ResourceLocation("manarz", "textures/models/Jellyfish.png");
	}
}
