package com.zivilon.cinder_loe.mixins;

import com.zivilon.cinder_loe.CinderLoE;
import com.zivilon.cinder_loe.client.model.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import java.util.HashMap;
import java.util.Map;

import lotr.client.model.LOTRArmorModels;
import lotr.client.model.LOTRModelArnorHelmet;
import lotr.client.model.LOTRModelBlackNumenoreanHelmet;
import lotr.client.model.LOTRModelBlackUrukHelmet;
import lotr.client.model.LOTRModelDorwinionElfHelmet;
import lotr.client.model.LOTRModelEasterlingHelmet;
import lotr.client.model.LOTRModelGaladhrimHelmet;
import lotr.client.model.LOTRModelGemsbokHelmet;
import lotr.client.model.LOTRModelGondolinHelmet;
import lotr.client.model.LOTRModelGondorHelmet;
import lotr.client.model.LOTRModelGulfChestplate;
import lotr.client.model.LOTRModelGundabadUrukHelmet;
import lotr.client.model.LOTRModelHaradRobes;
import lotr.client.model.LOTRModelHaradTurban;
import lotr.client.model.LOTRModelHarnedorChestplate;
import lotr.client.model.LOTRModelHarnedorHelmet;
import lotr.client.model.LOTRModelHeadPlate;
import lotr.client.model.LOTRModelHighElvenHelmet;
import lotr.client.model.LOTRModelLeatherHat;
import lotr.client.model.LOTRModelMoredainLionHelmet;
import lotr.client.model.LOTRModelMorgulHelmet;
import lotr.client.model.LOTRModelNearHaradWarlordHelmet;
import lotr.client.model.LOTRModelPartyHat;
import lotr.client.model.LOTRModelRohanMarshalHelmet;
import lotr.client.model.LOTRModelSwanChestplate;
import lotr.client.model.LOTRModelSwanHelmet;
import lotr.client.model.LOTRModelTauredainChieftainHelmet;
import lotr.client.model.LOTRModelTauredainGoldHelmet;
import lotr.client.model.LOTRModelUmbarHelmet;
import lotr.client.model.LOTRModelUrukHelmet;
import lotr.client.model.LOTRModelWingedHelmet;
import lotr.common.LOTRMod;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.item.Item;

@Mixin(LOTRArmorModels.class)
public class MixinLOTRArmorModels {

    @Shadow(remap = false)
    private Map<ModelBiped, Map<Item, ModelBiped>> specialArmorModels;

    @Shadow(remap = false)
    public void copyModelRotations(ModelBiped target, ModelBiped src) {
    }

    private Map<Item, ModelBiped> getSpecialModels(ModelBiped key) {
        Map<Item, ModelBiped> map = this.specialArmorModels.get(key);
        if (map == null) {
            map = new HashMap<Item, ModelBiped>();
            map.put(LOTRMod.leatherHat, new LOTRModelLeatherHat());
            map.put(LOTRMod.helmetGondor, new LOTRModelGondorHelmet(1.0F));
            map.put(LOTRMod.helmetElven, new LOTRModelGaladhrimHelmet(1.0F));
            map.put(LOTRMod.helmetGondorWinged, new LOTRModelWingedHelmet(1.0F));
            map.put(LOTRMod.helmetMorgul, new LOTRModelMorgulHelmet(1.0F));
            map.put(LOTRMod.helmetGemsbok, new LOTRModelGemsbokHelmet(1.0F));
            map.put(LOTRMod.helmetHighElven, new LOTRModelHighElvenHelmet(1.0F));
            map.put(LOTRMod.helmetBlackUruk, new LOTRModelBlackUrukHelmet(1.0F));
            map.put(LOTRMod.helmetUruk, new LOTRModelUrukHelmet(1.0F));
            map.put(LOTRMod.helmetNearHaradWarlord, new LOTRModelNearHaradWarlordHelmet(1.0F));
            map.put(LOTRMod.helmetDolAmroth, new LOTRModelSwanHelmet(1.0F));
            map.put(LOTRMod.bodyDolAmroth, new LOTRModelSwanChestplate(1.0F));
            map.put(LOTRMod.helmetMoredainLion, new LOTRModelMoredainLionHelmet(1.0F));
            map.put(LOTRMod.helmetHaradRobes, new LOTRModelHaradTurban());
            map.put(LOTRMod.bodyHaradRobes, new LOTRModelHaradRobes(1.0F));
            map.put(LOTRMod.legsHaradRobes, new LOTRModelHaradRobes(0.5F));
            map.put(LOTRMod.bootsHaradRobes, new LOTRModelHaradRobes(1.0F));
            map.put(LOTRMod.helmetGondolin, new LOTRModelGondolinHelmet(1.0F));
            map.put(LOTRMod.helmetRohanMarshal, new LOTRModelRohanMarshalHelmet(1.0F));
            map.put(LOTRMod.helmetTauredainChieftain, new LOTRModelTauredainChieftainHelmet(1.0F));
            map.put(LOTRMod.helmetTauredainGold, new LOTRModelTauredainGoldHelmet(1.0F));
            map.put(LOTRMod.helmetGundabadUruk, new LOTRModelGundabadUrukHelmet(1.0F));
            map.put(LOTRMod.helmetUrukBerserker, new LOTRModelUrukHelmet(1.0F));
            map.put(LOTRMod.helmetDorwinionElf, new LOTRModelDorwinionElfHelmet(1.0F));
            map.put(LOTRMod.partyHat, new LOTRModelPartyHat(0.6F));
            map.put(LOTRMod.helmetArnor, new LOTRModelArnorHelmet(1.0F));
            map.put(LOTRMod.helmetRhunGold, new LOTRModelEasterlingHelmet(1.0F, false));
            map.put(LOTRMod.helmetRhunWarlord, new LOTRModelEasterlingHelmet(1.0F, true));
            map.put(LOTRMod.helmetRivendell, new LOTRModelHighElvenHelmet(1.0F));
            map.put(LOTRMod.bodyGulfHarad, new LOTRModelGulfChestplate(1.0F));
            map.put(LOTRMod.helmetUmbar, new LOTRModelUmbarHelmet(1.0F));
            map.put(LOTRMod.helmetHarnedor, new LOTRModelHarnedorHelmet(1.0F));
            map.put(LOTRMod.bodyHarnedor, new LOTRModelHarnedorChestplate(1.0F));
            map.put(LOTRMod.helmetBlackNumenorean, new LOTRModelBlackNumenoreanHelmet(1.0F));
            map.put(CinderLoE.helmetRedDwarf, new ModelRedDwarfHelmet(1.0F));
            map.put(CinderLoE.helmetBreeKettle, new ModelBreeKettleHelmet(1.0F));
            map.put(CinderLoE.helmetbrokenhalo, new ModelBrokenHalo(1.0F));
            map.put(CinderLoE.helmetRhudaur, new ModelRhudaurHelmet(1.0F));
            map.put(CinderLoE.bodyserpent, new ModelBodySerpent(1.0F));
            map.put(CinderLoE.helmetUsurper, new ModelUsurperHelmet(1.0F));
            map.put(CinderLoE.helmetWarlord, new ModelWarlordHelmet(1.0f));
            map.put(CinderLoE.bodyJade, new ModelBodyJade(1.0f));
            map.put(CinderLoE.legsJade, new ModelLegsJade(1.0f));
            map.put(CinderLoE.helmetJade, new ModelJadeHelmet(1.0f));
            map.put(CinderLoE.helmetGildedGalvorn, new ModelGalvornHelmet(1.0f));
            map.put(CinderLoE.helmetEsgaroth, new ModelEsgarothHelmet(1.0f));
            map.put(CinderLoE.helmetDorLomin, new ModelDragonHelm(1.0f));
            map.put(LOTRMod.plate, new LOTRModelHeadPlate());
            map.put(LOTRMod.woodPlate, new LOTRModelHeadPlate());
            map.put(LOTRMod.ceramicPlate, new LOTRModelHeadPlate());
            map.put(CinderLoE.helmetDorwinionElite, new ModelDorwinionHelmet(1.0f));
            map.put(CinderLoE.bodyDorwinionElite, new ModelBodyDorwinionElite(1.0f));
            map.put(CinderLoE.helmetSunlitWarden, new ModelHelmetSunlitWarden(1.0f));
            map.put(CinderLoE.helmetOrthancGuard, new OrthancGuardHelmet(1.0f));
            for (ModelBiped armorModel : map.values())
                copyModelRotations(armorModel, key);
            this.specialArmorModels.put(key, map);
        }
        return map;
    }
}
