mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-04 20:39:09 +01:00
68 lines
2.3 KiB
Java
68 lines
2.3 KiB
Java
|
package de.ellpeck.naturesaura.reg;
|
||
|
|
||
|
import de.ellpeck.naturesaura.NaturesAura;
|
||
|
import de.ellpeck.naturesaura.items.ModItems;
|
||
|
import net.minecraft.inventory.EquipmentSlotType;
|
||
|
import net.minecraft.item.IArmorMaterial;
|
||
|
import net.minecraft.item.crafting.Ingredient;
|
||
|
import net.minecraft.util.LazyLoadBase;
|
||
|
import net.minecraft.util.SoundEvent;
|
||
|
import net.minecraft.util.SoundEvents;
|
||
|
import net.minecraftforge.api.distmarker.Dist;
|
||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||
|
|
||
|
import java.util.function.Supplier;
|
||
|
|
||
|
public enum NAArmorMaterial implements IArmorMaterial {
|
||
|
|
||
|
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0F, () -> Ingredient.fromItems(ModItems.INFUSED_IRON));
|
||
|
|
||
|
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
||
|
private final String name;
|
||
|
private final int maxDamageFactor;
|
||
|
private final int[] damageReductionAmountArray;
|
||
|
private final int enchantability;
|
||
|
private final SoundEvent soundEvent;
|
||
|
private final float toughness;
|
||
|
private final LazyLoadBase<Ingredient> repairMaterial;
|
||
|
|
||
|
NAArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float p_i48533_8_, Supplier<Ingredient> repairMaterialSupplier) {
|
||
|
this.name = nameIn;
|
||
|
this.maxDamageFactor = maxDamageFactorIn;
|
||
|
this.damageReductionAmountArray = damageReductionAmountsIn;
|
||
|
this.enchantability = enchantabilityIn;
|
||
|
this.soundEvent = equipSoundIn;
|
||
|
this.toughness = p_i48533_8_;
|
||
|
this.repairMaterial = new LazyLoadBase<>(repairMaterialSupplier);
|
||
|
}
|
||
|
|
||
|
public int getDurability(EquipmentSlotType slotIn) {
|
||
|
return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
|
||
|
}
|
||
|
|
||
|
public int getDamageReductionAmount(EquipmentSlotType slotIn) {
|
||
|
return this.damageReductionAmountArray[slotIn.getIndex()];
|
||
|
}
|
||
|
|
||
|
public int getEnchantability() {
|
||
|
return this.enchantability;
|
||
|
}
|
||
|
|
||
|
public SoundEvent getSoundEvent() {
|
||
|
return this.soundEvent;
|
||
|
}
|
||
|
|
||
|
public Ingredient getRepairMaterial() {
|
||
|
return this.repairMaterial.getValue();
|
||
|
}
|
||
|
|
||
|
@OnlyIn(Dist.CLIENT)
|
||
|
public String getName() {
|
||
|
return this.name;
|
||
|
}
|
||
|
|
||
|
public float getToughness() {
|
||
|
return this.toughness;
|
||
|
}
|
||
|
}
|