From 70e1f48de04fdd98e27b7cc2d13c4d763928f641 Mon Sep 17 00:00:00 2001 From: DaSH Date: Thu, 30 Apr 2026 10:36:16 +0200 Subject: [PATCH] No more hexadecimal display --- .../render/tileentity/RenderRBMKNumitron.java | 62 ++++-------------- .../machine/rbmk/TileEntityRBMKNumitron.java | 4 +- .../models/network/numitron_lights.png | Bin 487 -> 712 bytes 3 files changed, 13 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKNumitron.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKNumitron.java index 1e129296c..5d0bb2b62 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderRBMKNumitron.java +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKNumitron.java @@ -54,7 +54,6 @@ public class RenderRBMKNumitron extends TileEntitySpecialRenderer { double w = 8D / scale; double h = 13D / scale; double yOffset = 0.5625D; - double line_height = 0.25D; String value = ""; switch((int)unit.display_mode) { @@ -74,39 +73,6 @@ public class RenderRBMKNumitron extends TileEntitySpecialRenderer { } value = Long.toString(unit.value); break; - case 2: // Signed Hexadecimal display - // Overflow handling - if (unit.value > 0x7FFFFFF) { - value = "7ffffff"; - break; - } - // Underflow handling - // Theoretically this value is equal to 0x8000000 in a 28bit signed integer, but it's a long so we have to adapt - if (unit.value < -134217728) { - value = "8000000"; - break; - } - value = Long.toHexString(unit.value); - long length = value.length(); - - // A negative number will have many leading F's, so this needs to be accounted for - if(length > 7) { - value = value.substring((int)length-7); - } - break; - case 3: // Unsigned Hexadecimal display - // Overflow handling - if (unit.value > 0xFFFFFFF) { - value = "fffffff"; - break; - } - // Underflow handling - if (unit.value < 0) { - value = "-0"; - break; - } - value = Long.toHexString(unit.value); - break; default: value = BobMathUtil.getShortNumber(unit.value); break; @@ -136,28 +102,22 @@ public class RenderRBMKNumitron extends TileEntitySpecialRenderer { double u = -1; double v = 0; if(c == ' ') continue; - if(c == '.') {u = 0.9; v = 1*line_height;} - if(c == '-') {u = 0.8; v = 1*line_height;} - else if(c == 'k') {u = 0.0; v = 1*line_height;} - else if(c == 'M') {u = 0.1; v = 1*line_height;} - else if(c == 'G') {u = 0.2; v = 1*line_height;} - else if(c == 'T') {u = 0.3; v = 1*line_height;} - else if(c == 'P') {u = 0.4; v = 1*line_height;} - else if(c == 'E') {u = 0.5; v = 1*line_height;} - else if(c == 'a') {u = 0.0; v = 2*line_height;} - else if(c == 'b') {u = 0.1; v = 2*line_height;} - else if(c == 'c') {u = 0.2; v = 2*line_height;} - else if(c == 'd') {u = 0.3; v = 2*line_height;} - else if(c == 'e') {u = 0.4; v = 2*line_height;} - else if(c == 'f') {u = 0.5; v = 2*line_height;} // i would love to say this sucks, but this is actually surprisingly easy to read and probably the most performant way of doing it + if(c == '.') {u = 0.9; v = 0.5;} + if(c == '-') {u = 0.8; v = 0.5;} + else if(c == 'k') {u = 0.0; v = 0.5;} + else if(c == 'M') {u = 0.1; v = 0.5;} + else if(c == 'G') {u = 0.2; v = 0.5;} + else if(c == 'T') {u = 0.3; v = 0.5;} + else if(c == 'P') {u = 0.4; v = 0.5;} + else if(c == 'E') {u = 0.5; v = 0.5;} // i would love to say this sucks, but this is actually surprisingly easy to read and probably the most performant way of doing it int charVal = c - '0'; // no string operations, no int parsing, no nothing, we just rawdog this shit if(charVal >= 0 && charVal <= 9) {u = 0.1 * charVal; v = 0.0;} - if(u == -1) {u = 0.8; v = 1*line_height;} + if(u == -1) {u = 0.8; v = 0.5;} tess.setNormal(0F, 1F, 0F); - tess.addVertexWithUV(0.03135, -h + yOffset, w - zOffset, u, v + line_height); + tess.addVertexWithUV(0.03135, -h + yOffset, w - zOffset, u, v + 0.5); tess.addVertexWithUV(0.03135, h + yOffset, w - zOffset, u, v); tess.addVertexWithUV(0.03135, h + yOffset, -w - zOffset, u + 0.1, v); - tess.addVertexWithUV(0.03135, -h + yOffset, -w - zOffset, u + 0.1, v + line_height); + tess.addVertexWithUV(0.03135, -h + yOffset, -w - zOffset, u + 0.1, v + 0.5); } tess.draw(); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKNumitron.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKNumitron.java index 31a2f42a8..34eb63e4a 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKNumitron.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKNumitron.java @@ -92,7 +92,7 @@ public class TileEntityRBMKNumitron extends TileEntityLoadedBase implements IGUI public boolean no_leading_zeroes; /** Which digits are activated (bit mask, msb ignored) */ public long active_digits; - /** Display mode 0=normal, 1=integer, 2=signed hexadecimal 3=unsigned hexadecimal */ + /** Display mode 0=normal, 1=integer */ public long display_mode; public DisplayUnit(int initialIndex) { @@ -292,7 +292,7 @@ public class TileEntityRBMKNumitron extends TileEntityLoadedBase implements IGUI int idx = args.checkInteger(0) - 1; if(idx < 0 || idx >= 2) return new Object[] {false, "Invalid index (1-2)"}; long val = (long) args.checkInteger(1) - 1; - if(val < 0 || val >= 4) throw new IllegalArgumentException("Invalid value (1-4)"); + if(val < 0 || val >= 2) throw new IllegalArgumentException("Invalid value (1-2)"); displays[idx].display_mode = val; markDirty(); return new Object[] {true}; diff --git a/src/main/resources/assets/hbm/textures/models/network/numitron_lights.png b/src/main/resources/assets/hbm/textures/models/network/numitron_lights.png index 5fd0ed71a64f8344112c57f88b33d5ce6f4b4c43..438ad67240cb0b3f0344740fc558f5485135e237 100644 GIT binary patch delta 701 zcmV;u0z&=g1IPuC7k?TE1^@s6Aky2X00004b3#c}2nYxWdH-FMr&xXO|I+)%_?NiLCp1{fQ*;QE>~@vUhhq{CjCYj8OUUt0dA49kMIZ$Vj}k2x|2)|FeC<)+BD_twm7M$NWEwh!K7VN=a0L zl*FYXBEedOBuM&{e{&~d?F1zI)*>`z{n{e9xKH}^UiGiqUpkT#xG~Ce^K%xb;i*4P zV_5^$O17fBwik6gH$U|Wa2E}ny`2U+0Z=bqFg#H~aP3v>qh!56yxWcCvPVd%|;@wv_fN~T00JY~?hUx7J*nj}64sC@uF%{Ewzhy-6C8O;KHyJYT#HOGKh|0?yh jvBH(=m*>1}NbSIHT+k~E{O|eL00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj54^T{0MF0Q*X)FN0PXPbqV~02Z^7T;300009a7bBm000id000id0mpBsWB>pG zVM# z0p9VQ7p|H=fPXnk=c8wexUN1Hzcjr(0$H@16I2<$D{=tdbEKjts@B$;9hjea&TshV zz?1_K$ifMfl;+t(B^1}Z85mWBM