From 20d6189a0dd18875d69b26dddfb4a30fa606a5f8 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Wed, 16 Jul 2014 20:45:05 +0200 Subject: [PATCH] Only display mining-boost XP if it's actually obtainable (not obtainable for mining level stone) --- .../leveling/IguanaLevelingLogic.java | 9 +++++-- .../leveling/ToolTipHandler.java | 24 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/IguanaLevelingLogic.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/IguanaLevelingLogic.java index d65ee55..64cc0f4 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/IguanaLevelingLogic.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/IguanaLevelingLogic.java @@ -43,6 +43,12 @@ public abstract class IguanaLevelingLogic { public static boolean isBoosted(NBTTagCompound tags) { return tags.getBoolean(TAG_IS_BOOSTED); } public static boolean isMaxLevel(NBTTagCompound tags) { return getLevel(tags) >= MAX_LEVEL; } + public static boolean canBoostMiningLevel(int hLevel) + { + return hLevel >= TConstructRegistry.getMaterial("Copper").harvestLevel() && + (!IguanaConfig.pickaxeBoostRequired && hLevel < 6 || IguanaConfig.pickaxeBoostRequired && hLevel < 7); + } + /** * Add the leveling specific NBT. * @param tag The tag that should recieve the data. Usually InfiTool Tag. @@ -94,8 +100,7 @@ public abstract class IguanaLevelingLogic { // already got a boost? if (tags.hasKey(TAG_BOOST_EXP) && !tags.hasKey(TAG_IS_BOOSTED)) // todo: figure out why this only applies between mining level copper and 7? - if (hLevel >= TConstructRegistry.getMaterial("Copper").harvestLevel() && - (!IguanaConfig.pickaxeBoostRequired && hLevel < 6 || IguanaConfig.pickaxeBoostRequired && hLevel < 7)) { + if (canBoostMiningLevel(hLevel)) { tags.setLong(TAG_BOOST_EXP, boostXP); // check for mining boost levelup! diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/ToolTipHandler.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/ToolTipHandler.java index f1b08c0..93eefcc 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/ToolTipHandler.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/ToolTipHandler.java @@ -45,18 +45,20 @@ public class ToolTipHandler { { int hLevel = tags.getInteger("HarvestLevel"); String mLvl = IguanaLevelingTooltips.getMiningLevelTooltip(hLevel); - // add minimal xp if config option is set - if(!advanced && IguanaConfig.showMinimalTooltipXP && !IguanaLevelingLogic.isBoosted(tags)) - mLvl += " (" + IguanaLevelingTooltips.getBoostXpString(stack, tags, false) + ")"; - inserter.add(mLvl); + // is the pick applicable for mining level boosting? if yes display xp + if(IguanaLevelingLogic.canBoostMiningLevel(hLevel)) { + // add minimal xp if config option is set + if (!advanced && IguanaConfig.showMinimalTooltipXP && !IguanaLevelingLogic.isBoosted(tags)) + mLvl += " (" + IguanaLevelingTooltips.getBoostXpString(stack, tags, false) + ")"; + inserter.add(mLvl); - // advanced mining level boost progress info - if(advanced && IguanaConfig.levelingPickaxeBoost && IguanaConfig.showTooltipXP) - { - if(IguanaLevelingLogic.isBoosted(tags)) - inserter.add(IguanaLevelingTooltips.getBoostedTooltip()); - else - inserter.add(IguanaLevelingTooltips.getBoostXpToolTip(stack, tags)); + // advanced mining level boost progress info + if (advanced && IguanaConfig.levelingPickaxeBoost && IguanaConfig.showTooltipXP) { + if (IguanaLevelingLogic.isBoosted(tags)) + inserter.add(IguanaLevelingTooltips.getBoostedTooltip()); + else + inserter.add(IguanaLevelingTooltips.getBoostXpToolTip(stack, tags)); + } } }