-
Notifications
You must be signed in to change notification settings - Fork 755
/
ArmorMod.java
41 lines (35 loc) · 1.12 KB
/
ArmorMod.java
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
package tconstruct.library.armor;
import java.util.EnumSet;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.modifier.ItemModifier;
public abstract class ArmorMod extends ItemModifier
{
protected final EnumSet<ArmorPart> armorTypes;
public ArmorMod(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items)
{
super(items, effect, dataKey);
this.armorTypes = armorTypes;
}
@Override
protected boolean canModify (ItemStack armor, ItemStack[] input)
{
Item i = armor.getItem();
if (!(i instanceof ArmorCore))
return false;
ArmorCore item = (ArmorCore) armor.getItem();
if (armorTypes.contains(item.armorPart))
{
NBTTagCompound tags = getModifierTag(armor);
return tags.getInteger("Modifiers") > 0;
}
return false;
}
@Override
public boolean validType (IModifyable type)
{
return type.getModifyType().equals("Armor");
}
}