2014-02-08 13:30:19 -05:00
|
|
|
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;
|
2014-04-15 22:16:47 +02:00
|
|
|
import net.minecraft.util.StatCollector;
|
2014-02-08 13:30:19 -05:00
|
|
|
|
|
|
|
|
public class AModDoubleJump extends AModInteger
|
|
|
|
|
{
|
|
|
|
|
public AModDoubleJump(ItemStack[] items)
|
|
|
|
|
{
|
2014-04-17 01:03:24 -04:00
|
|
|
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", StatCollector.translateToLocal("modifier.armour.jump.double"));
|
2014-02-08 13:30:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
}
|
2014-02-11 21:35:05 -05:00
|
|
|
|
2014-02-08 13:30:19 -05:00
|
|
|
@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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-11 21:35:05 -05:00
|
|
|
|
2014-02-08 13:30:19 -05:00
|
|
|
@Override
|
|
|
|
|
protected String getProperName (String tooltip, String tag)
|
|
|
|
|
{
|
|
|
|
|
if (tag.contains("Double-Jump"))
|
2014-04-15 22:16:47 +02:00
|
|
|
return color + StatCollector.translateToLocal("modifier.armour.jump.triple");
|
2014-02-11 21:35:05 -05:00
|
|
|
|
2014-02-08 13:30:19 -05:00
|
|
|
if (tag.contains("Triple-Jump"))
|
2014-04-15 22:16:47 +02:00
|
|
|
return color + StatCollector.translateToLocal("modifier.armour.jump.quad");
|
2014-02-08 13:30:19 -05:00
|
|
|
|
2014-04-15 22:16:47 +02:00
|
|
|
return color + StatCollector.translateToLocal("modifier.armour.jump.double");
|
2014-02-08 13:30:19 -05:00
|
|
|
}
|
2014-04-15 22:16:47 +02:00
|
|
|
}
|