mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Initial commit
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user