I changed to Supplier, but got 2 errors: "The return type is incompatible with IArmorMaterial.getRepairMaterial()" and "The method fromItems(IItemProvider...) in the type Ingredient is not applicable for the arguments (Supplier<Item>)"
package com.tsurayamiku.hwga.lists;
import org.apache.logging.log4j.util.Supplier;
import com.tsurayamiku.hwga.Main;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
public enum ArmourMaterialList implements IArmorMaterial{
shukuryo("shukuryo", 400, new int[] {8, 10, 9, 7}, 25, ItemList.SHUKURYO_INGOT.get(), "item.armor.equip_netherite", 10, 10);
private static final int[] max_damage_array = new int[] {13, 15, 16, 11};
private String name, equipSound;
private int durability, enchantability, knockbackResistance;
private Supplier<Item> repairItem;
private int[] damageReductionAmounts;
private float toughness;
private ArmourMaterialList(String name, int durability, int[] damageReductionAmounts, int enchantability,
Item repairItem, String equipSound, float toughness, int knockbackResistance) {
this.name = name;
this.durability = durability;
this.damageReductionAmounts = damageReductionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.repairItem = (Supplier<Item>) repairItem;
this.knockbackResistance = knockbackResistance;
}
@Override
public int getDurability(EquipmentSlotType slot) {
return max_damage_array[slot.getIndex()] * this.durability;
}
@Override
public int getDamageReductionAmount(EquipmentSlotType slot) {
return this.damageReductionAmounts[slot.getIndex()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getSoundEvent() {
return new SoundEvent(new ResourceLocation(equipSound));
}
@Override
public Supplier<Ingredient> getRepairMaterial() {
return (Supplier<Ingredient>) Ingredient.fromItems(this.repairItem);
}
@Override
public String getName() {
return Main.MOD_ID + ":" + this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
}