package com.acethewildfire.acesbs.item;

import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.util.ModTags;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentAsset;
import net.minecraft.item.equipment.EquipmentAssetKeys;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;

import java.util.EnumMap;

public class ModArmorMaterials {
    static RegistryKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = RegistryKey.ofRegistry(Identifier.ofVanilla("equipment_asset"));

    public static final RegistryKey<EquipmentAsset> PRISMA_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "prisma_steel"));
    public static final RegistryKey<EquipmentAsset> ASHEN_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "ashen_steel"));

    public static final RegistryKey<EquipmentAsset> FRACTAL_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "fractal_diamond"));
    public static final RegistryKey<EquipmentAsset> HELLFIRE_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "hellfire_diamond"));

    public static final RegistryKey<EquipmentAsset> WILDFIRE_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "wildfire"));
    public static final RegistryKey<EquipmentAsset> PLATES_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "plates"));
    public static final RegistryKey<EquipmentAsset> BERSERKERS_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(AcesBS.MOD_ID, "berserkers"));

    public static final ArmorMaterial PRISMA_STEEL_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 2);
                map.put(EquipmentType.LEGGINGS, 5);
                map.put(EquipmentType.CHESTPLATE, 6);
                map.put(EquipmentType.HELMET, 2);
                map.put(EquipmentType.BODY, 5);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0, 0, ModTags.Items.PRISMA_REPAIR,
            PRISMA_KEY);

    public static final ArmorMaterial ASHEN_STEEL_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 2);
                map.put(EquipmentType.LEGGINGS, 5);
                map.put(EquipmentType.CHESTPLATE, 6);
                map.put(EquipmentType.HELMET, 2);
                map.put(EquipmentType.BODY, 5);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0, 0, ModTags.Items.ASHEN_REPAIR,
            ASHEN_KEY);

    public static final ArmorMaterial FRACTAL_DIAMOND_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 3);
                map.put(EquipmentType.LEGGINGS, 6);
                map.put(EquipmentType.CHESTPLATE, 8);
                map.put(EquipmentType.HELMET, 3);
                map.put(EquipmentType.BODY, 11);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2, 0, ModTags.Items.FRACTAL_REPAIR,
            FRACTAL_KEY);

    public static final ArmorMaterial HELLFIRE_DIAMOND_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 3);
                map.put(EquipmentType.LEGGINGS, 6);
                map.put(EquipmentType.CHESTPLATE, 8);
                map.put(EquipmentType.HELMET, 3);
                map.put(EquipmentType.BODY, 11);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2, 0, ModTags.Items.HELLFIRE_REPAIR,
            HELLFIRE_KEY);

    public static final ArmorMaterial WILDFIRE_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 3);
                map.put(EquipmentType.LEGGINGS, 6);
                map.put(EquipmentType.CHESTPLATE, 8);
                map.put(EquipmentType.HELMET, 3);
                map.put(EquipmentType.BODY, 11);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0, 0, ModTags.Items.WILDFIRE_REPAIR,
            WILDFIRE_KEY);

    public static final ArmorMaterial PLATES_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 0);
                map.put(EquipmentType.LEGGINGS, 0);
                map.put(EquipmentType.CHESTPLATE, 0);
                map.put(EquipmentType.HELMET, 0);
                map.put(EquipmentType.BODY, 0);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 0, 0, ModTags.Items.PLATES_REPAIR,
            PLATES_KEY);

    public static final ArmorMaterial BERSERKERS_ARMOR_MATERIAL = new ArmorMaterial(
            500,
            Util.make(new EnumMap<>(EquipmentType.class), map -> {
                map.put(EquipmentType.BOOTS, 2);
                map.put(EquipmentType.LEGGINGS, 5);
                map.put(EquipmentType.CHESTPLATE, 6);
                map.put(EquipmentType.HELMET, 2);
                map.put(EquipmentType.BODY, 5);
            }), 20, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0, 0, ModTags.Items.BERSERKERS_REPAIR,
            BERSERKERS_KEY);

}
