TheOnlyTails

RubyArmorMaterial

Sep 10th, 2020 (edited)
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.29 KB | None | 0 0
  1. public enum RubyArmorMaterial implements IArmorMaterial {
  2.     RUBY(TheOnlyTails.MOD_ID + ":ruby", 24,
  3.             new int[]{2, 5, 6, 2},
  4.             18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC,
  5.             0f,
  6.             () -> Ingredient.fromItems(
  7.                     ItemsRegistry.RUBY.get()), 0.5f);
  8.  
  9.     private static final int[] MAX_DAMAGE = {11, 16, 15, 13};
  10.     private final String name;
  11.     private final int maxDamageFactor;
  12.     private final int[] damageReductionAmount;
  13.     private final int enchantability;
  14.     private final SoundEvent soundEvent;
  15.     private final float toughness;
  16.     private final Supplier<Ingredient> repairMaterial;
  17.     private final float knockbackResistance;
  18.    
  19.     RubyArmorMaterial(String name, int maxDamageFactor,
  20.                       int[] damageReductionAmount, int enchantability,
  21.                       SoundEvent soundEvent, float toughness,
  22.                       Supplier<Ingredient> repairMaterial, float knockbackResistance) {
  23.         this.name = name;
  24.         this.maxDamageFactor = maxDamageFactor;
  25.         this.damageReductionAmount = damageReductionAmount;
  26.         this.enchantability = enchantability;
  27.         this.soundEvent = soundEvent;
  28.         this.toughness = toughness;
  29.         this.repairMaterial = repairMaterial;
  30.         this.knockbackResistance = knockbackResistance;
  31.     }
  32.  
  33.     @Override
  34.     public int getDurability(EquipmentSlotType slotIn) {
  35.         return MAX_DAMAGE[slotIn.getIndex()] * this.maxDamageFactor;
  36.     }
  37.  
  38.     @Override
  39.     public int getDamageReductionAmount(EquipmentSlotType slotIn) {
  40.         return this.damageReductionAmount[slotIn.getIndex()];
  41.     }
  42.  
  43.     @Override
  44.     public int getEnchantability() {
  45.         return this.enchantability;
  46.     }
  47.  
  48.     @Override
  49.     @Nonnull
  50.     public SoundEvent getSoundEvent() {
  51.         return this.soundEvent;
  52.     }
  53.  
  54.     @Override
  55.     @Nonnull
  56.     public Ingredient getRepairMaterial() {
  57.         return this.repairMaterial.get();
  58.     }
  59.  
  60.     @OnlyIn(Dist.CLIENT)
  61.     @Nonnull
  62.     @Override
  63.     public String getName() {
  64.         return this.name;
  65.     }
  66.  
  67.     @Override
  68.     public float getToughness() {
  69.         return this.toughness;
  70.     }
  71.  
  72.     @Override
  73.     public float getKnockbackResistance() {
  74.         return this.knockbackResistance;
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment