mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-05 04:49:10 +01:00
81 lines
2.8 KiB
Java
81 lines
2.8 KiB
Java
package de.ellpeck.naturesaura.reg;
|
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
|
import de.ellpeck.naturesaura.items.ModItems;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.world.entity.EquipmentSlot;
|
|
import net.minecraft.world.item.ArmorMaterial;
|
|
import net.minecraft.world.item.crafting.Ingredient;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
import net.minecraftforge.common.util.Lazy;
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
public enum ModArmorMaterial implements ArmorMaterial {
|
|
|
|
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_IRON, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
|
|
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_DIAMOND, 2, () -> Ingredient.of(ModItems.SKY_INGOT)),
|
|
DEPTH(NaturesAura.MOD_ID + ":depth", 37, new int[]{3, 6, 8, 3}, 18, SoundEvents.ARMOR_EQUIP_NETHERITE, 3, () -> Ingredient.of(ModItems.DEPTH_INGOT));
|
|
|
|
private static final int[] MAX_DAMAGE_ARRAY = {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 Lazy<Ingredient> repairMaterial;
|
|
|
|
ModArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float toughness, Supplier<Ingredient> repairMaterialSupplier) {
|
|
this.name = nameIn;
|
|
this.maxDamageFactor = maxDamageFactorIn;
|
|
this.damageReductionAmountArray = damageReductionAmountsIn;
|
|
this.enchantability = enchantabilityIn;
|
|
this.soundEvent = equipSoundIn;
|
|
this.toughness = toughness;
|
|
this.repairMaterial = Lazy.of(repairMaterialSupplier);
|
|
}
|
|
|
|
@Override
|
|
public int getDurabilityForSlot(EquipmentSlot slotIn) {
|
|
return ModArmorMaterial.MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
|
|
}
|
|
|
|
@Override
|
|
public int getDefenseForSlot(EquipmentSlot slotIn) {
|
|
return this.damageReductionAmountArray[slotIn.getIndex()];
|
|
}
|
|
|
|
@Override
|
|
public int getEnchantmentValue() {
|
|
return this.enchantability;
|
|
}
|
|
|
|
@Override
|
|
public SoundEvent getEquipSound() {
|
|
return this.soundEvent;
|
|
}
|
|
|
|
@Override
|
|
public Ingredient getRepairIngredient() {
|
|
return this.repairMaterial.get();
|
|
}
|
|
|
|
@Override
|
|
@OnlyIn(Dist.CLIENT)
|
|
public String getName() {
|
|
return this.name;
|
|
}
|
|
|
|
@Override
|
|
public float getToughness() {
|
|
return this.toughness;
|
|
}
|
|
|
|
@Override
|
|
public float getKnockbackResistance() {
|
|
return 0;
|
|
}
|
|
}
|