mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 06:59:22 +01:00
fixed armor not having durability
This commit is contained in:
parent
95838ff567
commit
96cd5963f5
2 changed files with 10 additions and 5 deletions
|
@ -35,7 +35,7 @@ public class ItemArmor extends ArmorItem implements IModItem {
|
|||
private final String baseName;
|
||||
|
||||
public ItemArmor(String baseName, ModArmorMaterial materialIn, ArmorItem.Type equipmentSlotIn) {
|
||||
super(materialIn.material, equipmentSlotIn, new Properties());
|
||||
super(materialIn.material, equipmentSlotIn, new Properties().durability(materialIn.getDurability(equipmentSlotIn)));
|
||||
this.baseName = baseName;
|
||||
ModRegistry.ALL_ITEMS.add(this);
|
||||
}
|
||||
|
|
|
@ -18,13 +18,15 @@ import java.util.function.Supplier;
|
|||
|
||||
public enum ModArmorMaterial {
|
||||
|
||||
INFUSED(NaturesAura.MOD_ID + ":infused_iron", new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_IRON, 0, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
|
||||
SKY(NaturesAura.MOD_ID + ":sky", new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_DIAMOND, 2, 0, () -> Ingredient.of(ModItems.SKY_INGOT)),
|
||||
DEPTH(NaturesAura.MOD_ID + ":depth", new int[]{3, 6, 8, 3}, 18, SoundEvents.ARMOR_EQUIP_NETHERITE, 3, 1, () -> Ingredient.of(ModItems.DEPTH_INGOT));
|
||||
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_IRON, 0, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
|
||||
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_DIAMOND, 2, 0, () -> Ingredient.of(ModItems.SKY_INGOT)),
|
||||
DEPTH(NaturesAura.MOD_ID + ":depth", 37, new int[]{3, 6, 8, 3}, 18, SoundEvents.ARMOR_EQUIP_NETHERITE, 3, 1, () -> Ingredient.of(ModItems.DEPTH_INGOT));
|
||||
|
||||
public final Holder<ArmorMaterial> material;
|
||||
private final int maxDamageFactor;
|
||||
|
||||
ModArmorMaterial(String nameIn, int[] damageReductionAmountsIn, int enchantabilityIn, Holder<SoundEvent> equipSoundIn, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterialSupplier) {
|
||||
ModArmorMaterial(String nameIn, int maxDamageFactor, int[] damageReductionAmountsIn, int enchantabilityIn, Holder<SoundEvent> equipSoundIn, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterialSupplier) {
|
||||
this.maxDamageFactor = maxDamageFactor;
|
||||
var res = ResourceLocation.parse(nameIn);
|
||||
var defense = new EnumMap<ArmorItem.Type, Integer>(ArmorItem.Type.class);
|
||||
defense.put(ArmorItem.Type.BOOTS, damageReductionAmountsIn[0]);
|
||||
|
@ -35,4 +37,7 @@ public enum ModArmorMaterial {
|
|||
this.material = Registry.registerForHolder(BuiltInRegistries.ARMOR_MATERIAL, res, new ArmorMaterial(defense, enchantabilityIn, equipSoundIn, repairMaterialSupplier, layers, toughness, knockbackResistance));
|
||||
}
|
||||
|
||||
public int getDurability(ArmorItem.Type type) {
|
||||
return type.getDurability(this.maxDamageFactor);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue