package com.zivilon.cinder_loe.mixins;

import com.zivilon.cinder_loe.util.LOTREnchantmentExclusions;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import lotr.common.enchant.LOTREnchantmentType;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

@Mixin(LOTREnchantmentType.class)
public class MixinLOTREnchantmentType {

    @Inject(method = "canApply", at = @At("HEAD"), cancellable = true, remap = false)
    public void onCanApply(ItemStack itemstack, boolean considering, CallbackInfoReturnable<Boolean> cir) {
        Item item = itemstack.getItem();
        if (LOTREnchantmentExclusions.exclusions.contains(item)) {
            cir.setReturnValue(false);
        }
    }
}
