@Override public final NBTTagCompound buildTag(List<Material> materials) { return buildTagData(materials).get(); }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ToolBuilder.addEnchantment(rootCompound, Enchantments.SILK_TOUCH); ToolNBT toolData = TagUtil.getToolStats(rootCompound); toolData.speed = Math.max(1f, toolData.speed - 3f); toolData.attack = Math.max(1f, toolData.attack - 3f); TagUtil.setToolTag(rootCompound, toolData.get()); } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ToolNBT data = TagUtil.getToolStats(rootCompound); data.durability += 500; if(data.harvestLevel < HarvestLevels.OBSIDIAN) { data.harvestLevel++; } data.attack += 1f; data.speed += 0.5f; TagUtil.setToolTag(rootCompound, data.get()); } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ToolNBT data = TagUtil.getToolStats(rootCompound); ToolNBT base = TagUtil.getOriginalToolStats(rootCompound); data.durability += base.durability / 2; if(data.harvestLevel < HarvestLevels.DIAMOND) { data.harvestLevel++; } TagUtil.setToolTag(rootCompound, data.get()); } }
@SubscribeEvent public void onToolBuilding(TinkerEvent.OnItemBuilding event) { if(TinkerUtil.hasTrait(event.tag, this.getIdentifier())) { ToolNBT data = TagUtil.getToolStats(event.tag); // reduce durability by 20% data.durability = Math.max(1, (data.durability * 80) / 100); TagUtil.setToolTag(event.tag, data.get()); } } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { // apply bonus damage if it hasn't been applied yet if(!TinkerUtil.hasTrait(rootCompound, identifier)) { // +damage ToolNBT data = TagUtil.getToolStats(rootCompound); data.attack += damage; TagUtil.setToolTag(rootCompound, data.get()); } super.applyEffect(rootCompound, modifierTag); } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { super.applyEffect(rootCompound, modifierTag); // called on tool loading only // we just apply the saved bonus stats ToolNBT data = TagUtil.getToolStats(rootCompound); StatNBT bonus = getBonus(rootCompound); data.durability += bonus.durability; data.speed += bonus.speed; data.attack += bonus.attack; TagUtil.setToolTag(rootCompound, data.get()); }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { // apply bonus damage if it hasn't been applied yet if(!TinkerUtil.hasTrait(rootCompound, identifier)) { // +damage ToolNBT data = TagUtil.getToolStats(rootCompound); data.speed += speed; TagUtil.setToolTag(rootCompound, data.get()); } super.applyEffect(rootCompound, modifierTag); } }
@Override public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { super.applyEffect(rootCompound, modifierTag); ToolNBT stats = TagUtil.getToolStats(rootCompound); stats.durability = 999999; stats.attack = 999999f; stats.speed = 999999f; stats.modifiers = 0; TagUtil.setToolTag(rootCompound, stats.get()); TagUtil.setNoRenameFlag(rootCompound, true); }
@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()); } }
TagUtil.setToolTag(tool, data.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()); } }
TagUtil.setToolTag(root, data.get());