package com.acethewildfire.acesbs.item.custom;

import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.item.PrismaSteelItems;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

public class SovsPlateCarrierArmorItem extends Item {
    public SovsPlateCarrierArmorItem(Settings settings) {
        super(settings);
    }

    @Override
    public boolean isItemBarVisible(ItemStack stack) {
        return true;
    }

    @Override
    public int getItemBarStep(ItemStack stack) {
        return Math.round(13.0F * (1.0F - (float) stack.getDamage() / stack.getMaxDamage()));
    }

    @Override
    public int getItemBarColor(ItemStack stack) {
        float f = Math.max(0.0F, ((float) stack.getMaxDamage() - stack.getDamage()) / stack.getMaxDamage());
        return MathHelper.hsvToRgb(f / 3.0F, 1.0F, 1.0F);
    }

    public static float getDamageMultiplier(ItemStack stack) {
        float durabilityRatio =
                (float)(stack.getMaxDamage() - stack.getDamage()) / stack.getMaxDamage();

        // 0 durability → 1.0x damage
        // full durability → 0.01x damage (99% reduction)
        return 1.0f - (durabilityRatio * 0.99f);
    }
}
