package com.zivilon.cinder_loe.client.render;

import com.zivilon.cinder_loe.entity.Wraith;
import com.zivilon.cinder_loe.entity.boss.CryptBoss;
import lotr.client.model.LOTRModelMarshWraith;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

public class RenderCryptBoss extends RenderLiving {
    private static ResourceLocation skin = new ResourceLocation("cinder_loe:mob/wraith/wraith.png");

    public RenderCryptBoss() {
        super((ModelBase)new LOTRModelMarshWraith(), 0.5F);
    }
    
    protected ResourceLocation getEntityTexture(Entity entity) {
        return skin;
    }
    
    protected void preRenderCallback(EntityLivingBase entity, float f) {
        super.preRenderCallback(entity, f);
        float f1 = 0.9375F;
        float hover = MathHelper.sin((((Entity)entity).ticksExisted + f) * 0.15F) * 0.2F - 0.5F;
        GL11.glScalef(f1, f1, f1);
        GL11.glTranslatef(0.0F, hover, 0.0F);
        CryptBoss wraith = (CryptBoss)entity;
        if (wraith.getDeathFadeTime() > 0) {
            GL11.glEnable(3042);
            GL11.glBlendFunc(770, 771);
            GL11.glEnable(3008);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, wraith.getDeathFadeTime() / 30.0F);
        } 
    }
    
    protected float getDeathMaxRotation(EntityLivingBase entity) {
        return 0.0F;
    }
}
