-
Notifications
You must be signed in to change notification settings - Fork 753
/
AModDoubleJump.java
73 lines (65 loc) · 2.46 KB
/
AModDoubleJump.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.AModInteger;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.EnumArmorPart;
import net.minecraft.util.StatCollector;
public class AModDoubleJump extends AModInteger
{
public AModDoubleJump(ItemStack[] items)
{
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", StatCollector.translateToLocal("modifier.armour.jump.double");
}
@Override
protected boolean canModify (ItemStack armor, ItemStack[] input)
{
ArmorCore item = (ArmorCore) armor.getItem();
if (armorTypes.contains(item.armorPart))
{
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
return tags.getInteger("Modifiers") >= modifyCount && tags.getInteger("Double-Jump") < 3;
}
return false;
}
@Override
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int tipNum = 0;
while (true)
{
tipNum++;
String tip = "Tooltip" + tipNum;
if (!tags.hasKey(tip))
{
tags.setString(tip, tooltip);
String modTip = "ModifierTip" + tipNum;
tags.setString(modTip, modifierTip);
return tipNum;
}
else
{
String tag = tags.getString(tip);
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump"))
{
tags.setString(tip, getProperName(tooltip, tag));
String modTip = "ModifierTip" + tipNum;
tag = tags.getString(modTip);
tags.setString(modTip, getProperName(modifierTip, tag));
return tipNum;
}
}
}
}
@Override
protected String getProperName (String tooltip, String tag)
{
if (tag.contains("Double-Jump"))
return color + StatCollector.translateToLocal("modifier.armour.jump.triple");
if (tag.contains("Triple-Jump"))
return color + StatCollector.translateToLocal("modifier.armour.jump.quad");
return color + StatCollector.translateToLocal("modifier.armour.jump.double");
}
}