-
Notifications
You must be signed in to change notification settings - Fork 755
/
AModLeadBoots.java
52 lines (43 loc) · 1.72 KB
/
AModLeadBoots.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
42
43
44
45
46
47
48
49
50
51
52
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import tconstruct.library.armor.ArmorPart;
public class AModLeadBoots extends AModBoolean
{
public AModLeadBoots(ItemStack[] items)
{
super(2, "LeadBoots", EnumSet.of(ArmorPart.Feet), items, "\u00a78", "Lead Boots");
}
@Override
public void modify (ItemStack[] recipe, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName(armor));
armorTag.setBoolean(key, true);
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= 1;
armorTag.setInteger("Modifiers", modifiers);
addToolTip(armor, color + tooltipName, color + key);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
attributes = baseTag.getTagList("AttributeModifiers", 0);
for (int iter = 0; iter < attributes.tagCount(); iter++)
{
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
if (tag.getString("AttributeName").equals("generic.knockbackResistance"))
attributes.removeTag(iter);
}
}
else
{
attributes = new NBTTagList();
baseTag.setTag("AttributeModifiers", attributes);
}
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, 0.4, true, shoes));
}
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
}