Fix Tools with a diamond-modifier and disabled harvestlevel tweaks not getting the correct Harvest Level on tool replacement #64

This commit is contained in:
Bernhard Bonigl committed 2015-01-01 18:55:09 +01:00
1 parent 07adafa79c
commit 96cce32eb1
1 file changed
+15
@@ -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))
{