Advertisement
Guest User

Untitled

a guest
Feb 12th, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1.  
  2. package net.minecraft.item;
  3.  
  4. import java.util.function.Supplier;
  5.  
  6. import io.github.TailowOfficial.core.init.ItemInit;
  7. import net.minecraft.inventory.EquipmentSlotType;
  8. import net.minecraft.item.crafting.Ingredient;
  9. import net.minecraft.util.LazyValue;
  10. import net.minecraft.util.SoundEvent;
  11. import net.minecraft.util.SoundEvents;
  12. import net.minecraftforge.api.distmarker.Dist;
  13. import net.minecraftforge.api.distmarker.OnlyIn;
  14.  
  15. public enum ArmorMaterial implements IArmorMaterial {
  16. incognito("amethyst", 37, new int[]{3, 6, 8, 3}, 15, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.0F, 0.1F, () -> {
  17. return Ingredient.fromItems(ItemInit.amethyst_gem.get());
  18. });
  19.  
  20. private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
  21. private final String name;
  22. private final int maxDamageFactor;
  23. private final int[] damageReductionAmountArray;
  24. private final int enchantability;
  25. private final SoundEvent soundEvent;
  26. private final float toughness;
  27. private final float knockbackResistance;
  28. private final LazyValue<Ingredient> repairMaterial;
  29.  
  30. private ArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) {
  31. this.name = name;
  32. this.maxDamageFactor = maxDamageFactor;
  33. this.damageReductionAmountArray = damageReductionAmountArray;
  34. this.enchantability = enchantability;
  35. this.soundEvent = soundEvent;
  36. this.toughness = toughness;
  37. this.knockbackResistance = knockbackResistance;
  38. this.repairMaterial = new LazyValue<>(repairMaterial);
  39. }
  40.  
  41. public int getDurability(EquipmentSlotType slotIn) {
  42. return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
  43. }
  44.  
  45. public int getDamageReductionAmount(EquipmentSlotType slotIn) {
  46. return this.damageReductionAmountArray[slotIn.getIndex()];
  47. }
  48.  
  49. public int getEnchantability() {
  50. return this.enchantability;
  51. }
  52.  
  53. public SoundEvent getSoundEvent() {
  54. return this.soundEvent;
  55. }
  56.  
  57. public Ingredient getRepairMaterial() {
  58. return this.repairMaterial.getValue();
  59. }
  60.  
  61. @OnlyIn(Dist.CLIENT)
  62. public String getName() {
  63. return this.name;
  64. }
  65.  
  66. public float getToughness() {
  67. return this.toughness;
  68. }
  69.  
  70. /**
  71. * Gets the percentage of knockback resistance provided by armor of the material.
  72. */
  73. public float getKnockbackResistance() {
  74. return this.knockbackResistance;
  75. }
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement