@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ModifierNBT.IntegerNBT modData = ModifierNBT.readInteger(modifierTag); Set<Category> categories = ImmutableSet.copyOf(TagUtil.getCategories(rootCompound)); boolean harvest = categories.contains(Category.HARVEST); boolean weapon = categories.contains(Category.WEAPON); boolean launcher = categories.contains(Category.LAUNCHER); ToolNBT data = TagUtil.getToolStats(rootCompound); int level = modData.current / max; // only boost mining speed if we have a harvest tool if(harvest) { applyHarvestBoost(modData, data, level); } // attack speed: each total level adds 0.2 to the modifier, though individual redstone piece above the level add 0.004 each // so in short: 0.004 per redstone if(weapon) { data.attackSpeedMultiplier += getSpeedBonus(modData); } TagUtil.setToolTag(rootCompound, data.get()); // bow speed: if(launcher) { ProjectileLauncherNBT launcherData = new ProjectileLauncherNBT(TagUtil.getToolTag(rootCompound)); launcherData.drawSpeed += launcherData.drawSpeed * getDrawspeedBonus(modData); TagUtil.setToolTag(rootCompound, launcherData.get()); } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { super.applyEffect(rootCompound, modifierTag); // add the attack speed boost ToolNBT data = TagUtil.getToolStats(rootCompound); // apply using the base value of 1.0f, as otherwise this will apply twice on tools with multiple lightweight parts data.attackSpeedMultiplier = 1.0f + bonus; TagUtil.setToolTag(rootCompound, data.get()); if(TinkerUtil.hasCategory(rootCompound, Category.LAUNCHER)) { ProjectileLauncherNBT launcherData = new ProjectileLauncherNBT(TagUtil.getToolTag(rootCompound)); launcherData.drawSpeed += launcherData.drawSpeed * bonus; TagUtil.setToolTag(rootCompound, launcherData.get()); } }