@Override public void modify(ItemStack[] input, ItemStack tool) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); if (tags.hasKey(key)) { int amount = 24; ToolCore toolItem = (ToolCore) tool.getItem(); if (toolItem.pierceArmor() || !nerfType(toolItem)) amount = 36; int[] keyPair = tags.getIntArray(key); int leftToBoost = amount - (keyPair[0] % amount); if (increase >= leftToBoost) { int attack = tags.getInteger("Attack"); attack += 1; tags.setInteger("Attack", attack); } 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 = "\u00a7f" + guiType + " (" + increase + "/" + max + ")"; int tooltipIndex = addToolTip(tool, tooltipName, modName); int[] keyPair = new int[] {increase, max, tooltipIndex}; tags.setIntArray(key, keyPair); int attack = tags.getInteger("Attack"); attack += 1; tags.setInteger("Attack", attack); } }
public boolean nerfType(ToolCore tool) { List list = Arrays.asList(tool.toolCategories()); return list.contains("throwing"); }
public boolean validType(ToolCore tool) { List list = Arrays.asList(tool.toolCategories()); return list.contains("melee") || list.contains("harvest"); }