From ee317c7f505df72e1ac5970fcbd907fb062b74c8 Mon Sep 17 00:00:00 2001 From: efefury <69400149+efefury@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:46:53 +0200 Subject: i love commas man (#170) * i love commas man commas underrated * changed locale ok nea --- .../profileviewer/GuiProfileViewer.java | 41 +++++++++++----------- .../moulberry/notenoughupdates/util/ItemUtils.java | 4 ++- 2 files changed, 23 insertions(+), 22 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 b1e76dcc..fef2868c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1973,7 +1973,7 @@ public class GuiProfileViewer extends GuiScreen { String totalXpStr = null; if (skillName.contains("Catacombs")) totalXpStr = EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + - Utils.formatNumberWithDots((long) levelObj.totalXp); + numberFormat.format(levelObj.totalXp); if (levelObj.maxed) { levelStr = EnumChatFormatting.GOLD + "MAXED!"; } else { @@ -2556,7 +2556,8 @@ public class GuiProfileViewer extends GuiScreen { ); } - Utils.drawStringCentered(shortNumberFormat(amount, 0) + "", fontRendererObj, + Utils.drawStringCentered( + shortNumberFormat(amount, 0) + "", fontRendererObj, guiLeft + x + 10, guiTop + y + 26, true, color.getRGB() ); @@ -3882,7 +3883,7 @@ public class GuiProfileViewer extends GuiScreen { EnumChatFormatting.GOLD + "Speed" + EnumChatFormatting.GRAY + ".", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(miningSpeed + 2, 3) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format(Math.pow(miningSpeed + 2, 3)) + " Mithril Powder" ) : Lists.newArrayList( "Mining Speed", EnumChatFormatting.GRAY + "Level " + miningSpeed + EnumChatFormatting.DARK_GRAY + "/50", @@ -3907,7 +3908,7 @@ public class GuiProfileViewer extends GuiScreen { EnumChatFormatting.GOLD + "Fortune" + EnumChatFormatting.GRAY + ".", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(miningFortune + 2, 3.05) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format(Math.pow(miningFortune + 2, 3)) + " Mithril Powder" ) : Lists.newArrayList( "Mining Fortune", EnumChatFormatting.GRAY + "Level " + miningFortune + EnumChatFormatting.DARK_GRAY + "/50", @@ -3934,7 +3935,7 @@ public class GuiProfileViewer extends GuiScreen { EnumChatFormatting.GRAY + "Ore.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(tittyInsane + 2, 3.1) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(tittyInsane + 2, 3)) + " Mithril Powder" ) : Lists.newArrayList( "Titanium Insanium", EnumChatFormatting.GRAY + "Level " + tittyInsane + EnumChatFormatting.DARK_GRAY + "/50", @@ -3999,7 +4000,7 @@ public class GuiProfileViewer extends GuiScreen { "§2Dwarven Mines " + EnumChatFormatting.GRAY + "by " + EnumChatFormatting.GREEN + luckofcaveStat + "%§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(luckofcave + 2, 3.07) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(luckofcave + 2, 3.07)) + " Mithril Powder" ) : Lists.newArrayList( "Luck of the Cave", "§7Level " + luckofcave + EnumChatFormatting.DARK_GRAY + "/45", @@ -4053,7 +4054,7 @@ public class GuiProfileViewer extends GuiScreen { EnumChatFormatting.GRAY + "adjacent ores.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(effMiner + 2, 2.6) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(effMiner + 2, 2.6)) + " Mithril Powder" ) : Lists.newArrayList( "Efficient Miner", EnumChatFormatting.GRAY + "Level " + effMiner + EnumChatFormatting.DARK_GRAY + "/100", @@ -4167,7 +4168,7 @@ public class GuiProfileViewer extends GuiScreen { (moleStat == 1.0 ? "." : "s."), "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(mole + 2, 2.2) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(mole + 2, 2.2)) + " Gemstone Powder" ) : Lists.newArrayList( "Mole", EnumChatFormatting.GRAY + "Level " + mole + EnumChatFormatting.DARK_GRAY + "/190", @@ -4194,7 +4195,7 @@ public class GuiProfileViewer extends GuiScreen { EnumChatFormatting.GRAY + "Powder and Gemstone Powder§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(powderBuff + 2, 3.2) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(powderBuff + 2, 3.2)) + " Gemstone Powder" ) : Lists.newArrayList( "Powder Buff", EnumChatFormatting.GRAY + "Level " + powderBuff + EnumChatFormatting.DARK_GRAY + "/50", @@ -4256,7 +4257,7 @@ public class GuiProfileViewer extends GuiScreen { "§7experience gain by " + EnumChatFormatting.GREEN + seasonMineStat + "%§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(seasonMine + 2, 2.3) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(seasonMine + 2, 2.3)) + " Mithril Powder" ) : Lists.newArrayList( "Seasoned Mineman", "§7Level " + seasonMine + "§8/100", @@ -4294,7 +4295,7 @@ public class GuiProfileViewer extends GuiScreen { "§7while in the Crystal Hollows.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(lonesomeMiner + 2, 3.07) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(lonesomeMiner + 2, 3.07)) + " Gemstone Powder" ) : Lists.newArrayList( "Lonesome Miner", "§7Level " + lonesomeMiner + EnumChatFormatting.DARK_GRAY + "/45", @@ -4319,7 +4320,7 @@ public class GuiProfileViewer extends GuiScreen { "§6Speed§7 when mining Gemstones.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(professional + 2, 2.3) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(professional + 2, 2.3)) + " Gemstone Powder" ) : Lists.newArrayList( "Professional", "§7Level " + professional + EnumChatFormatting.DARK_GRAY + "/140", @@ -4342,7 +4343,7 @@ public class GuiProfileViewer extends GuiScreen { "§6Speed§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(miningSpeed2 + 2, 3.2) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format(Math.pow(miningSpeed2 + 2, 3))+ " Gemstone Powder" ) : Lists.newArrayList( "Mining Speed 2", "§7Level " + miningSpeed2 + EnumChatFormatting.DARK_GRAY + "/50", @@ -4365,7 +4366,7 @@ public class GuiProfileViewer extends GuiScreen { "§7forge by §a" + (quickForgeStat < 20 ? quickForgeStat : 30) + "%§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(quickForge + 2, 4) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(quickForge + 2, 4)) + " Mithril Powder" ) : Lists.newArrayList( "Quick Forge", "§7Level " + quickForge + EnumChatFormatting.DARK_GRAY + "/20", @@ -4388,7 +4389,7 @@ public class GuiProfileViewer extends GuiScreen { "§6Fortune§7 when mining Gemstone.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(fortunate + 2, 3.05) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(fortunate + 2, 3.05)) + " Mithril Powder" ) : Lists.newArrayList( "Fortunate", "§7Level " + fortunate + EnumChatFormatting.DARK_GRAY + "/20", @@ -4411,7 +4412,7 @@ public class GuiProfileViewer extends GuiScreen { "§7find treasure.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(greatExplorer + 2, 4) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(greatExplorer + 2, 4)) + " Gemstone Powder" ) : Lists.newArrayList( "Great Explorer", "§7Level " + greatExplorer + EnumChatFormatting.DARK_GRAY + "/20", @@ -4433,7 +4434,7 @@ public class GuiProfileViewer extends GuiScreen { "§7Grants §a+§a" + miningFortune2Stat + "§7 §6☘ Mining", "§6Fortune§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + "" + (int) Math.pow(miningFortune2 + 2, 3.2) + " Gemstone Powder" + EnumChatFormatting.LIGHT_PURPLE + "" + numberFormat.format((int) Math.pow(miningFortune2 + 2, 3.2)) + " Gemstone Powder" ) : Lists.newArrayList( "Mining Fortune 2", "§7Level " + miningFortune2 + EnumChatFormatting.DARK_GRAY + "/50", @@ -4523,7 +4524,7 @@ public class GuiProfileViewer extends GuiScreen { "§7§5Fallen Stars§7.", "", EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (int) Math.pow(crystallized + 2, 2.4) + " Mithril Powder" + EnumChatFormatting.DARK_GREEN + "" + numberFormat.format((int) Math.pow(crystallized + 2, 2.4)) + " Mithril Powder" ) : Lists.newArrayList( "Crystallized", "§7Level " + crystallized + EnumChatFormatting.DARK_GRAY + "/30", @@ -5151,9 +5152,7 @@ public class GuiProfileViewer extends GuiScreen { tooltipToDisplay.add(EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.DARK_PURPLE + shortNumberFormat(Math.round((level % 1) * maxXp), 0) + "/" + shortNumberFormat(maxXp, 0)); } - String totalXpS = NumberFormat - .getIntegerInstance() - .format((int) skillInfo.get("experience_" + entry.getKey()).getAsFloat()); + String totalXpS = numberFormat.format((int) skillInfo.get("experience_" + entry.getKey()).getAsFloat()); tooltipToDisplay.add(EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + totalXpS); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index 6abcc33d..3a2db0fb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -24,9 +24,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; public class ItemUtils { @@ -45,7 +47,7 @@ public class ItemUtils { "ewogICJ0aW1lc3RhbXAiIDogMTYzNTk1NzQ4ODQxNywKICAicHJvZmlsZUlkIiA6ICJmNThkZWJkNTlmNTA0MjIyOGY2MDIyMjExZDRjMTQwYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJ1bnZlbnRpdmV0YWxlbnQiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2I5NTFmZWQ2YTdiMmNiYzIwMzY5MTZkZWM3YTQ2YzRhNTY0ODE1NjRkMTRmOTQ1YjZlYmMwMzM4Mjc2NmQzYiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9"; } ItemStack skull = Utils.createSkull( - "\u00A7r\u00A76" + Utils.formatNumberWithDots(coinAmount) + " Coins", + "\u00A7r\u00A76" + NumberFormat.getInstance(Locale.US).format(coinAmount) + " Coins", uuid, texture ); -- cgit