Guest User

Untitled

a guest
Sep 20th, 2021
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.60 KB | None | 0 0
  1. package com.doctorwafflephd.doctorwafflemod.core.enums;
  2.  
  3. import com.doctorwafflephd.doctorwafflemod.WaffleMod;
  4. import net.minecraft.inventory.EquipmentSlotType;
  5. import net.minecraft.item.ArmorItem;
  6. import net.minecraft.item.IArmorMaterial;
  7. import net.minecraft.item.Items;
  8. import net.minecraft.item.crafting.Ingredient;
  9. import net.minecraft.util.SoundEvent;
  10. import net.minecraft.util.SoundEvents;
  11. import net.minecraftforge.api.distmarker.Dist;
  12. import net.minecraftforge.api.distmarker.OnlyIn;
  13.  
  14. import java.util.function.Supplier;
  15.  
  16. public enum ModArmorEnums implements IArmorMaterial {
  17.  
  18.     NAUTILUS("nautilus", 30, new int[]{0,0,0,3}, 12, SoundEvents.ARMOR_EQUIP_TURTLE, 1.0f, 0.0f, () -> {return Ingredient.of(Items.NAUTILUS_SHELL);});
  19.  
  20.     private static final int[] DURABILITY_PER_SLOT = new int[]{13, 16, 15, 11};
  21.     private final String name;
  22.     private final int durabilityFactor;
  23.     private final int[] armorArray;
  24.     private final int enchantability;
  25.     private final SoundEvent soundEvent;
  26.     private final float toughness;
  27.     private final Supplier<Ingredient> repairMaterial;
  28.     private final float knockbackResistance;
  29.  
  30.     ModArmorEnums(String name, int durabilityFactor, int[] armorArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) {
  31.         this.name = name;
  32.         this.durabilityFactor = durabilityFactor;
  33.         this.armorArray = armorArray;
  34.         this.enchantability = enchantability;
  35.         this.soundEvent = soundEvent;
  36.         this.toughness = toughness;
  37.         this.repairMaterial = repairMaterial;
  38.         this.knockbackResistance = knockbackResistance;
  39.     }
  40.  
  41.     @Override
  42.     public int getDurabilityForSlot(EquipmentSlotType slotType) {
  43.         return DURABILITY_PER_SLOT[slotType.getIndex()] * this.durabilityFactor ;
  44.     }
  45.  
  46.     @Override
  47.     public int getDefenseForSlot(EquipmentSlotType slotType) {
  48.         return this.armorArray[slotType.getIndex()];
  49.     }
  50.  
  51.     @Override
  52.     public int getEnchantmentValue() {
  53.         return this.enchantability;
  54.     }
  55.  
  56.     @Override
  57.     public SoundEvent getEquipSound() {
  58.         return this.soundEvent;
  59.     }
  60.  
  61.     @Override
  62.     public Ingredient getRepairIngredient() {
  63.         return this.repairMaterial.get();
  64.     }
  65.  
  66.     @OnlyIn(Dist.CLIENT)
  67.     @Override
  68.     public String getName() {
  69.         return this.name;
  70.     }
  71.  
  72.     @Override
  73.     public float getToughness() {
  74.         return this.toughness;
  75.     }
  76.  
  77.     @Override
  78.     public float getKnockbackResistance() {
  79.         return this.knockbackResistance;
  80.     }
  81. }
  82.  
Advertisement
Add Comment
Please, Sign In to add comment