From 96cce32eb16ef95e216fcdb48cd6ea5257401099 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Thu, 1 Jan 2015 18:55:09 +0100 Subject: [PATCH] Fix Tools with a diamond-modifier and disabled harvestlevel tweaks not getting the correct Harvest Level on tool replacement #64 --- .../replacing/ReplacementLogic.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java index 69e0c7b..d4e7d0f 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java @@ -5,6 +5,7 @@ import iguanaman.iguanatweakstconstruct.leveling.LevelingLogic; import iguanaman.iguanatweakstconstruct.leveling.modifiers.ModXpAwareRedstone; import iguanaman.iguanatweakstconstruct.reference.Config; import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import iguanaman.iguanatweakstconstruct.util.Log; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -24,6 +25,7 @@ import tconstruct.modifiers.tools.ModAttack; import tconstruct.modifiers.tools.ModRedstone; import tconstruct.tools.TinkerTools; import tconstruct.tools.logic.ToolStationLogic; +import tconstruct.util.config.PHConstruct; import tconstruct.weaponry.TinkerWeaponry; import static iguanaman.iguanatweakstconstruct.replacing.ReplacementLogic.PartTypes.*; @@ -187,6 +189,19 @@ public final class ReplacementLogic { if(tags.hasKey("GemBoost")) tags.removeTag("GemBoost"); + // if boosted by vanilla diamond modifier, then we have to respect that. + if(!Config.changeDiamondModifier || !IguanaTweaksTConstruct.pulsar.isPulseLoaded(Reference.PULSE_HARVESTTWEAKS)) + // vanilla tcon allows harvestlevel change + if(PHConstruct.miningLevelIncrease) + { + // was the tool boosted with a diamond? + if(tags.getBoolean("Diamond") && tags.getInteger("HarvestLevel") < HarvestLevels._6_obsidian) // returns false if tag is not present + tags.setInteger("HarvestLevel", HarvestLevels._6_obsidian); + // ...with an emerald? + if(tags.getBoolean("Emerald") && tags.getInteger("HarvestLevel") < HarvestLevels._5_diamond) + tags.setInteger("HarvestLevel", HarvestLevels._5_diamond); + } + // handle Leveling/xp (has to be done first before we change the stats so we get the correct old values) if(LevelingLogic.hasXp(tags)) {