mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Finish armor porting
This commit is contained in:
1 parent
c13c8f8050
commit
2bb35b18e0
10 files changed
+449
-229
No files matched your search
@@ -1,66 +0,0 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class AModInteger extends ArmorMod
|
||||
{
|
||||
public final int modifyCount;
|
||||
public final int amount;
|
||||
public final String color;
|
||||
public final String tooltipName;
|
||||
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int count, int increase, String c, String tip)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
this.modifyCount = count;
|
||||
this.amount = increase;
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@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 = armor.getTagCompound().getCompoundTag(getTagName(armor));
|
||||
return tags.getInteger("Modifiers") > modifyCount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName(tool));
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int increase = tags.getInteger(key);
|
||||
increase += this.amount;
|
||||
tags.setInteger(key, increase);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags.setInteger(key, amount);
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= modifyCount;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user