-
Notifications
You must be signed in to change notification settings - Fork 755
/
AModInteger.java
56 lines (47 loc) · 1.55 KB
/
AModInteger.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
53
54
55
56
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.*;
/* Adds an integer NBTTag */
public class AModInteger extends ArmorMod
{
String color;
String tooltipName;
int initialIncrease;
int secondaryIncrease;
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase, String c, String tip)
{
super(effect, dataKey, armorTypes, items);
initialIncrease = secondaryIncrease = increase;
color = c;
tooltipName = tip;
}
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase1, int increase2, String c, String tip)
{
super(effect, dataKey, armorTypes, items);
initialIncrease = increase1;
secondaryIncrease = increase2;
color = c;
tooltipName = tip;
}
@Override
public void modify (ItemStack[] recipe, ItemStack input)
{
NBTTagCompound tags = getModifierTag(input);
if (tags.hasKey(key))
{
int increase = tags.getInteger(key);
increase += secondaryIncrease;
tags.setInteger(key, increase);
}
else
{
tags.setInteger(key, initialIncrease);
}
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
addToolTip(input, color + tooltipName, color + key);
}
}