This repository was archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathArmorMaterialImpl.java
More file actions
65 lines (54 loc) · 1.89 KB
/
ArmorMaterialImpl.java
File metadata and controls
65 lines (54 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.dimdev.rift.util;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyLoadBase;
import net.minecraft.util.SoundEvent;
import java.util.function.Supplier;
public class ArmorMaterialImpl implements IArmorMaterial {
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 LazyLoadBase<Ingredient> ingredient;
public ArmorMaterialImpl(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, Supplier<Ingredient> ingredientSupplier) {
this.name = name;
this.maxDamageFactor = maxDamageFactor;
this.damageReductionAmountArray = damageReductionAmountArray;
this.enchantability = enchantability;
this.soundEvent = soundEvent;
this.toughness = toughness;
this.ingredient = new LazyLoadBase<>(ingredientSupplier);
}
@Override
public int getDurability(EntityEquipmentSlot slot) {
return getDurability(slot) * maxDamageFactor;
}
@Override
public int getDamageReductionAmount(EntityEquipmentSlot slot) {
return damageReductionAmountArray[slot.getIndex()];
}
@Override
public int getEnchantability() {
return enchantability;
}
@Override
public SoundEvent getSoundEvent() {
return soundEvent;
}
@Override
public Ingredient getRepairMaterial() {
return ingredient.getValue();
}
@Override
public String getName() {
return name;
}
@Override
public float getToughness() {
return toughness;
}
}