Only display mining-boost XP if it's actually obtainable (not obtainable for mining level stone)

This commit is contained in:
Bernhard Bonigl committed 2014-07-16 20:45:05 +02:00
1 parent 5371cb7fc2
commit 20d6189a0d
2 files changed
+20 -13

No files matched your search

@@ -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!
@@ -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));
}
}
}