aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-08 17:00:49 +0200
committerGitHub <noreply@github.com>2022-09-08 17:00:49 +0200
commitd3805f080af87eb2bc7d2a2eac6c3f8db539324f (patch)
tree2aaf95a14d1cb82096c1c2d675ebe6b7147dab48 /src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
parent827acac6fcf836c1dba5bea338f726694951d18e (diff)
downloadnotenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.tar.gz
notenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.tar.bz2
notenoughupdates-d3805f080af87eb2bc7d2a2eac6c3f8db539324f.zip
0.14 - Finished :) (#233)
Co-authored-by: nopo <noahogno@gmail.com> Co-authored-by: jani270 <69345714+jani270@users.noreply.github.com> Co-authored-by: Ascynx <78341107+Ascynx@users.noreply.github.com> Co-authored-by: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index 59373952..0f9d1b4a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
@@ -283,20 +284,9 @@ public class GuiProfileViewer extends GuiScreen {
return levelObj;
}
+ @Deprecated
public static String shortNumberFormat(double n, int iteration) {
- if (n < 1000) {
- if (n % 1 == 0) {
- return Integer.toString((int) n);
- } else {
- return String.format("%.2f", n);
- }
- }
-
- double d = ((long) n / 100) / 10.0;
- boolean isRound = (d * 10) % 10 == 0;
- return d < 1000 ? (isRound || d > 9.99 ? (int) d * 10 / 10 : d + "") + "" + c[iteration] : shortNumberFormat(
- d,
- iteration + 1
+ return StringUtils.shortNumberFormat(n, iteration
);
}
@@ -1013,9 +1003,9 @@ public class GuiProfileViewer extends GuiScreen {
int maxXp = (int) levelObj.maxXpForLevel;
levelStr =
EnumChatFormatting.DARK_PURPLE +
- shortNumberFormat(Math.round((level % 1) * maxXp), 0) +
+ StringUtils.shortNumberFormat(Math.round((level % 1) * maxXp)) +
"/" +
- shortNumberFormat(maxXp, 0);
+ StringUtils.shortNumberFormat(maxXp);
}
if (totalXpStr != null) {
tooltipToDisplay = Utils.createList(levelStr, totalXpStr);