Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.item;
- import java.util.function.Supplier;
- import io.github.TailowOfficial.core.init.ItemInit;
- import net.minecraft.inventory.EquipmentSlotType;
- import net.minecraft.item.crafting.Ingredient;
- import net.minecraft.util.LazyValue;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.util.SoundEvents;
- import net.minecraftforge.api.distmarker.Dist;
- import net.minecraftforge.api.distmarker.OnlyIn;
- public enum ArmorMaterial implements IArmorMaterial {
- incognito("amethyst", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.0F, 0.1F, () -> {
- return Ingredient.fromItems(ItemInit.amethyst_gem.get());
- });
- 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 float knockbackResistance;
- private final LazyValue<Ingredient> repairMaterial;
- private ArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) {
- this.name = name;
- this.maxDamageFactor = maxDamageFactor;
- this.damageReductionAmountArray = damageReductionAmountArray;
- this.enchantability = enchantability;
- this.soundEvent = soundEvent;
- this.toughness = toughness;
- this.knockbackResistance = knockbackResistance;
- this.repairMaterial = new LazyValue<>(repairMaterial);
- }
- 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;
- }
- /**
- * Gets the percentage of knockback resistance provided by armor of the material.
- */
- public float getKnockbackResistance() {
- return this.knockbackResistance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement