aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor-Colenso <52056774+Connor-Colenso@users.noreply.github.com>2023-12-11 08:02:58 +0000
committerGitHub <noreply@github.com>2023-12-11 09:02:58 +0100
commitc315a6cfa8e167bf00a4238bd707c44f47227be7 (patch)
tree05756e47be74e72cb14dc7998478da2b4148c705
parent1056634daa7ca4fa4a59240f83aea0eb0785b6c4 (diff)
downloadGT5-Unofficial-c315a6cfa8e167bf00a4238bd707c44f47227be7.tar.gz
GT5-Unofficial-c315a6cfa8e167bf00a4238bd707c44f47227be7.tar.bz2
GT5-Unofficial-c315a6cfa8e167bf00a4238bd707c44f47227be7.zip
Change EoH number formatting to standard form (#266)
* Format numbers better with standard form * this class was removed/migrate earlier --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java3
-rw-r--r--src/main/java/com/github/technus/tectech/util/TT_Utility.java15
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
index 37592a3d9f..3df0c495d3 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
@@ -5,6 +5,7 @@ import static com.github.technus.tectech.thing.CustomItemList.astralArrayFabrica
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.eyeOfHarmonyRenderBlock;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0;
+import static com.github.technus.tectech.util.TT_Utility.toStandardForm;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
@@ -1502,7 +1503,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
} else {
str.add(
"Estimated EU/t: " + RED
- + ReadableNumberConverter.INSTANCE.toWideReadableForm(euPerTick.longValue())
+ + toStandardForm(euPerTick)
+ RESET
+ " EU/t");
}
diff --git a/src/main/java/com/github/technus/tectech/util/TT_Utility.java b/src/main/java/com/github/technus/tectech/util/TT_Utility.java
index ba87811364..1ffe19ef0b 100644
--- a/src/main/java/com/github/technus/tectech/util/TT_Utility.java
+++ b/src/main/java/com/github/technus/tectech/util/TT_Utility.java
@@ -32,6 +32,21 @@ public final class TT_Utility {
return getFormatter().format("%+.5E", value).toString();
}
+ // Formats to standard form.
+ public static String toStandardForm(long number) {
+ if (number == 0) {
+ return "0";
+ }
+
+ int exponent = (int) Math.floor(Math.log10(Math.abs(number)));
+ double mantissa = number / Math.pow(10, exponent);
+
+ // Round the mantissa to two decimal places
+ mantissa = Math.round(mantissa * 100.0) / 100.0;
+
+ return mantissa + "*10^" + exponent;
+ }
+
public static int bitStringToInt(String bits) {
if (bits == null) {
return 0;