Fixed XP tooltip percentage

This commit is contained in:
iguana_man committed 2013-12-06 03:20:45 +09:00
1 parent b98c8776d6
commit 1bb9eedb4d
2 files changed
+5 -6

No files matched your search

@@ -48,10 +48,11 @@ public class IguanaLevelingLogic {
int requiredXp = getRequiredXp(tool, tags);
long currentXp = tags.getLong("ToolEXP");
String xpPercentage = Integer.toString((int)(tags.getLong("ToolEXP") / (long)getRequiredXp(tool, tags))) + "%";
int xpPercentage = (int)((currentXp / (long)requiredXp) * 100);
String xpPercentageString = Integer.toString(xpPercentage) + "%";
if (IguanaConfig.detailedXpTooltip)
return "XP: " + Long.toString(currentXp) + " / " + Integer.toString(requiredXp) + " (" + xpPercentage + ")";
return "XP: " + Long.toString(currentXp) + " / " + Integer.toString(requiredXp) + " (" + xpPercentageString + ")";
else
return "XP: " + xpPercentage;
}
@@ -151,15 +151,13 @@ public class IguanaModUpgrade extends ToolMod {
int bonus = tags.getInteger("BonusDurability");
float modDur = tags.getFloat("ModDurability");
int total = (int) ((base + bonus) * (modDur + 1f));
if (total <= 0)
total = 1;
int total = Math.max((int) ((base + bonus) * (modDur + 1f)), 1);
tags.setInteger("BaseDurability", base);
tags.setInteger("TotalDurability", total);
if (tags.hasKey("HarvestLevelModified"))
{
tags.setLong("HeadEXP", 0L);
tags.removeTag("HarvestLevelModified");
if (tags.hasKey("MobHead"))