package com.zivilon.cinder_loe.client.render.corrupt;

import com.zivilon.cinder_loe.entity.corrupt.CorruptDwarf;
import lotr.client.LOTRTextures;
import lotr.client.model.LOTRModelDwarf;
import lotr.client.model.LOTRModelEnt;
import lotr.client.render.entity.LOTRGlowingEyes;
import lotr.client.render.entity.LOTRRandomSkins;
import lotr.client.render.entity.LOTRRenderBiped;
import lotr.common.entity.npc.LOTREntityEnt;
import lotr.common.entity.npc.LOTREntityTree;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;

import java.util.HashMap;

public class RenderCorruptEnt extends RenderLiving {
    private static HashMap entTextures = new HashMap();
    private LOTRModelEnt eyesModel = new LOTRModelEnt(0.05f);

    public RenderCorruptEnt() {
        super((ModelBase)new LOTRModelEnt(), 0.5f);
    }

    protected ResourceLocation getEntityTexture(Entity entity) {
        int treeType = ((LOTREntityEnt)entity).getTreeType();
        String s = "cinder_loe:mob/corrupt/ent/" + LOTREntityTree.TYPES[treeType] + ".png";
        ResourceLocation r = (ResourceLocation)entTextures.get(treeType);
        if (r == null) {
            r = new ResourceLocation(s);
            entTextures.put(treeType, r);
        }
        return r;
    }

    protected void renderModel(EntityLivingBase entity, float f, float f1, float f2, float f3, float f4, float f5) {
        super.renderModel(entity, f, f1, f2, f3, f4, f5);
        ResourceLocation eyes = LOTRTextures.getEyesTexture(this.getEntityTexture((Entity)entity), new int[][]{{15, 23}, {22, 23}}, 3, 2);
        LOTRGlowingEyes.renderGlowingEyes((Entity)entity, eyes, this.eyesModel, f, f1, f2, f3, f4, f5);
    }
}
