2019-11-04 19:08:49 +01:00
|
|
|
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;
|
2020-01-28 18:08:56 +01:00
|
|
|
import net.minecraft.util.LazyValue;
|
2019-11-04 19:08:49 +01:00
|
|
|
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;
|
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
public enum ModArmorMaterial implements IArmorMaterial {
|
2019-11-04 19:08:49 +01:00
|
|
|
|
|
|
|
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;
|
2020-01-28 18:08:56 +01:00
|
|
|
private final LazyValue<Ingredient> repairMaterial;
|
2019-11-04 19:08:49 +01:00
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
ModArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float toughness, Supplier<Ingredient> repairMaterialSupplier) {
|
2019-11-04 19:08:49 +01:00
|
|
|
this.name = nameIn;
|
|
|
|
this.maxDamageFactor = maxDamageFactorIn;
|
|
|
|
this.damageReductionAmountArray = damageReductionAmountsIn;
|
|
|
|
this.enchantability = enchantabilityIn;
|
|
|
|
this.soundEvent = equipSoundIn;
|
2020-01-21 21:04:44 +01:00
|
|
|
this.toughness = toughness;
|
2020-01-28 18:08:56 +01:00
|
|
|
this.repairMaterial = new LazyValue<>(repairMaterialSupplier);
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public int getDurability(EquipmentSlotType slotIn) {
|
|
|
|
return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public int getDamageReductionAmount(EquipmentSlotType slotIn) {
|
|
|
|
return this.damageReductionAmountArray[slotIn.getIndex()];
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public int getEnchantability() {
|
|
|
|
return this.enchantability;
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public SoundEvent getSoundEvent() {
|
|
|
|
return this.soundEvent;
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public Ingredient getRepairMaterial() {
|
|
|
|
return this.repairMaterial.getValue();
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public String getName() {
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public float getToughness() {
|
|
|
|
return this.toughness;
|
|
|
|
}
|
|
|
|
}
|