Initial commit

This commit is contained in:
mDiyo committed 2013-01-18 23:43:53 -08:00
commit 8e3684ae99
118 files changed
+7790

No files matched your search

@@ -0,0 +1,35 @@
package tinker.tconstruct.modifiers;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/* Adds a boolean NBTTag */
public class ModBoolean extends ToolMod
{
public ModBoolean(ItemStack[] items, int effect, String tag)
{
super(items, effect, tag);
}
protected boolean canModify (ItemStack tool)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); //Will fail if the modifier is false or the tag doesn't exist
}
@Override
public void modify (ItemStack[] input, ItemStack tool)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
if (!tags.hasKey(key))
{
tags.setBoolean(key, true);
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
}
}
}