diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-10-05 00:02:32 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-10-15 04:54:18 -0500 |
| commit | d67ec64707414df6f78f45ec1710b4ec3fc1ef66 (patch) | |
| tree | 6a926cb12990aa88cb62e8ec099045f5b54fd8b1 /src/main/java/gmail/Lance5057/modifiers/modifierDaze.java | |
| parent | adefc630eb6876c19660c4f51876cc9bf00d78f0 (diff) | |
Refactor and Compartmentalize all the codes!
Diffstat (limited to 'src/main/java/gmail/Lance5057/modifiers/modifierDaze.java')
| -rw-r--r-- | src/main/java/gmail/Lance5057/modifiers/modifierDaze.java | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java b/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java deleted file mode 100644 index cf30e66..0000000 --- a/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java +++ /dev/null @@ -1,97 +0,0 @@ -package gmail.Lance5057.modifiers; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.library.tools.ToolCore; -import tconstruct.modifiers.tools.ItemModTypeFilter; - -public class modifierDaze extends ItemModTypeFilter -{ - String tooltipName; - int max = 5; - String guiType; - - public modifierDaze(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "Daze", items, values); - tooltipName = "\u00A76Daze"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - if (tool.getItem() instanceof ToolCore) - { - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("weapon")) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - if (!tags.hasKey(key)) - return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; - - if (matchingAmount(input) > max) - return false; - - int keyPair[] = tags.getIntArray(key); - if (keyPair[0] + matchingAmount(input) <= keyPair[1]) - return true; - - else if (keyPair[0] == keyPair[1]) - return tags.getInteger("Modifiers") > 0; - } - } - - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - if (tags.hasKey(key)) - { - int[] keyPair = tags.getIntArray(key); - - if (keyPair[0] % max == 0) - { - keyPair[0] += increase; - keyPair[1] += max; - tags.setIntArray(key, keyPair); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - } - else - { - keyPair[0] += increase; - tags.setIntArray(key, keyPair); - } - updateModTag(tool, keyPair); - - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - int[] keyPair = new int[] { increase, max, tooltipIndex }; - tags.setIntArray(key, keyPair); - } - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -}
\ No newline at end of file |
