diff options
author | D-Cysteine <54219287+D-Cysteine@users.noreply.github.com> | 2021-10-23 21:19:44 -0600 |
---|---|---|
committer | D-Cysteine <54219287+D-Cysteine@users.noreply.github.com> | 2021-10-23 21:19:44 -0600 |
commit | fda1ee40c41d6e1e4e4bb4d5cba22ea530ebaf8c (patch) | |
tree | 9c3050e5edc27260b67b21b72256a91995a1701b /src | |
parent | c224095cb6f73941d12adfb0b2e1cd2f144dfd82 (diff) | |
download | GT5-Unofficial-fda1ee40c41d6e1e4e4bb4d5cba22ea530ebaf8c.tar.gz GT5-Unofficial-fda1ee40c41d6e1e4e4bb4d5cba22ea530ebaf8c.tar.bz2 GT5-Unofficial-fda1ee40c41d6e1e4e4bb4d5cba22ea530ebaf8c.zip |
Try to use locale formatting
* Also format some more of the portable scanner's output
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 6 | ||||
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Utility.java | 13 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 41203c3ad2..10d5ec774a 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -802,8 +802,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE // Uncomment this line to print out tick-by-tick times. //tList.add("tTime " + tTime); } - tList.add("Average CPU load of ~" + (tAverageTime / mTimeStatistics.length) + "ns over " + mTimeStatistics.length + " ticks with worst time of " + tWorstTime + "ns."); - tList.add("Recorded " + mMetaTileEntity.mSoundRequests + " sound requests in " + (mTickTimer - mLastCheckTick) + " ticks." ); + tList.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) + "ns over " + GT_Utility.formatNumbers(mTimeStatistics.length) + " ticks with worst time of " + GT_Utility.formatNumbers(tWorstTime) + "ns."); + tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in " + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks." ); mLastCheckTick = mTickTimer; mMetaTileEntity.mSoundRequests = 0; } @@ -814,7 +814,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } if (aLogLevel > 0) { if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) - tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam"); + tList.add(GT_Utility.formatNumbers(getStoredSteam()) + " of " + GT_Utility.formatNumbers(getSteamCapacity()) + " Steam"); tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN+"active"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"inactive"+EnumChatFormatting.RESET)); if (!mHasEnoughEnergy) tList.add(EnumChatFormatting.RED+"ATTENTION: This Device needs more power."+EnumChatFormatting.RESET); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index b3f3c6d666..16d22be9ef 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -78,7 +78,7 @@ import javax.annotation.Nullable; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.text.DecimalFormat; +import java.text.NumberFormat; import java.text.DecimalFormatSymbols; import java.util.*; import java.util.Map.Entry; @@ -98,7 +98,7 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; */ public class GT_Utility { /** Formats a number with group separator and at most 2 fraction digits. */ - private static final DecimalFormat decimalFormat = new DecimalFormat(); + private static final NumberFormat numberFormat = NumberFormat.getInstance(); /** * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there. @@ -116,10 +116,7 @@ public class GT_Utility { public static UUID defaultUuid = null; // maybe default non-null? UUID.fromString("00000000-0000-0000-0000-000000000000"); static { - DecimalFormatSymbols symbols = decimalFormat.getDecimalFormatSymbols(); - symbols.setGroupingSeparator(' '); - decimalFormat.setDecimalFormatSymbols(symbols); - decimalFormat.setMaximumFractionDigits(2); + numberFormat.setMaximumFractionDigits(2); GregTech_API.sItemStackMappings.add(sFilledContainerToData); GregTech_API.sItemStackMappings.add(sEmptyContainerToFluidToData); @@ -2308,11 +2305,11 @@ public class GT_Utility { } public static String formatNumbers(long aNumber) { - return decimalFormat.format(aNumber); + return numberFormat.format(aNumber); } public static String formatNumbers(double aNumber) { - return decimalFormat.format(aNumber); + return numberFormat.format(aNumber); } /* |