diff options
author | Lulonaut <lulonaut@lulonaut.tech> | 2023-10-27 03:19:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 03:19:20 +0200 |
commit | ee8216c5982ce3028dba85df872b9f268b961ad7 (patch) | |
tree | fbb90fa23f2f7649caf6fb47c411a0bcdfc47e47 /src/main | |
parent | d0777258570d0f70239352fdaa625b25dc5a2b45 (diff) | |
download | NotEnoughUpdates-ee8216c5982ce3028dba85df872b9f268b961ad7.tar.gz NotEnoughUpdates-ee8216c5982ce3028dba85df872b9f268b961ad7.tar.bz2 NotEnoughUpdates-ee8216c5982ce3028dba85df872b9f268b961ad7.zip |
Fix "+" not being added for pet replacements properly (#890)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 7f9d1089..ce2cd340 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -26,6 +26,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import io.github.moulberry.notenoughupdates.auction.APIManager; +import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; import io.github.moulberry.notenoughupdates.miscgui.KatSitterOverlay; @@ -1357,16 +1358,18 @@ public class NEUManager { for (int i = 0; i < otherNumsMax.size(); i++) { replacements.put( "" + i, - (addZero ? "0\u27A1" : "") + - removeUnusedDecimal(Math.floor(otherNumsMin.get(i).getAsFloat() * 10) / 10f) + - "\u27A1" + removeUnusedDecimal(Math.floor(otherNumsMax.get(i).getAsFloat() * 10) / 10f) + (addZero ? "0\u27A1" : "") + StringUtils.formatNumber(otherNumsMin.get(i).getAsDouble()) + + "\u27A1" + StringUtils.formatNumber(otherNumsMax.get(i).getAsDouble()) ); } for (Map.Entry<String, JsonElement> entry : max.get("statNums").getAsJsonObject().entrySet()) { - int statMax = (int) Math.floor(entry.getValue().getAsFloat()); - int statMin = (int) Math.floor(min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat()); - String statStr = (statMin > 0 ? "+" : "") + statMin + "\u27A1" + statMax; + double statMax = entry.getValue().getAsDouble(); + double statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsDouble(); + + String statStr = + (statMin > 0 ? "+" : "") + StringUtils.formatNumber(statMin) + "\u27A1" + StringUtils.formatNumber( + statMax); statStr = (addZero ? "0\u27A1" : "") + statStr; replacements.put(entry.getKey(), statStr); } |