package jesse.keeblarcraft.Armor;

import jesse.keeblarcraft.Keeblarcraft;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;

public class MetalJacketArmor implements ArmorMaterial {
    // All references to this class must refer to this
    public static final MetalJacketArmor INSTANCE = new MetalJacketArmor();

    int defaultArmorModifier = 3;

    /// FUNCTIONS BELOW

    public MetalJacketArmor() {
        System.out.println("Constructor for armor called");
    }

    @Override
    public int getDurability(ArmorItem.Type type) {
        System.out.println("durability for armor called");
        // Replace this multiplier by a constant value for the durability of the armor.
        // For reference, diamond uses 33 for all armor pieces, whilst leather uses 5.
        return switch (type) { // All from ArmorItem.Type
            case BOOTS -> Integer.MAX_VALUE;
            case LEGGINGS -> Integer.MAX_VALUE;
            case CHESTPLATE -> Integer.MAX_VALUE;
            case HELMET -> Integer.MAX_VALUE;
        };
    }

    @Override
    public int getProtection(ArmorItem.Type type) {
        System.out.println("Protection called");
        // Protection values for all the slots.
        // For reference, diamond uses 3 for boots, 6 for leggings, 8 for chestplate, and 3 for helmet,
        // whilst leather uses 1, 2, 3 and 1 respectively.
        return switch (type) {
            case BOOTS -> defaultArmorModifier;
            case HELMET -> defaultArmorModifier;
            case LEGGINGS -> defaultArmorModifier;
            case CHESTPLATE -> defaultArmorModifier;
        };
    }

    @Override
    public int getEnchantability() {
        return Integer.MAX_VALUE;
    }

    @Override
    public SoundEvent getEquipSound() {
        // Example for Iron Armor
        return SoundEvents.ITEM_ARMOR_EQUIP_IRON;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return Ingredient.ofItems(Items.BEDROCK); // prayfully impossible repair or just not worth it
    }

    @Override
    public String getName() {
        return Keeblarcraft.MOD_ID + ":" + "metaljacket";
    }

    @Override
    public float getToughness() {
        // Toughness is the actual "resistance" the armor provides to HIGH damage attacks
        return (float) defaultArmorModifier;
    }

    @Override
    public float getKnockbackResistance() {
        return 0;
    }
}