First work on Numitron GUI

This commit is contained in:
DaSH 2026-04-30 12:08:01 +02:00
parent a3c89f6077
commit 93a159c342
2 changed files with 11 additions and 7 deletions

View File

@ -21,7 +21,7 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rbmk_numitron.png");
public TileEntityRBMKNumitron display;
protected int xSize = 256;
protected int ySize = 114;
protected int ySize = 150;
protected int guiLeft;
protected int guiTop;
@ -29,6 +29,8 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
protected GuiTextField[] rtty = new GuiTextField[2];
protected boolean[] active = new boolean[2];
protected boolean[] polling = new boolean[2];
protected boolean[] shorten_number = new boolean[2];
protected boolean[] leading_zeroes = new boolean[2];
public GUIScreenRBMKDisplay(TileEntityRBMKNumitron display) {
this.display = display;
@ -46,13 +48,15 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
int oY = 4;
for(int i = 0; i < 2; i++) {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 30, display.displays[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, display.displays[i].rtty);
active[i] = display.displays[i].active;
polling[i] = display.displays[i].polling;
shorten_number[i] = display.displays[i].shorten_number;
leading_zeroes[i] = display.displays[i].leading_zeroes;
}
}
@ -76,8 +80,8 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
for(int i = 0; i < 2; i++) {
if(this.active[i]) drawTexturedModalRect(guiLeft + 111, guiTop + i * 36 + 54, 18, 114, 16, 16);
if(this.polling[i]) drawTexturedModalRect(guiLeft + 128, guiTop + i * 36 + 53, 0, 114, 18, 18);
if(this.active[i]) drawTexturedModalRect(guiLeft + 111, guiTop + i * 54 + 54, 18, 150, 16, 16);
if(this.polling[i]) drawTexturedModalRect(guiLeft + 128, guiTop + i * 54 + 53, 0, 150, 18, 18);
}
for(int i = 0; i < 2; i++) {
@ -91,13 +95,13 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
super.mouseClicked(x, y, b);
for(int i = 0; i < 2; i++) {
if(guiLeft + 111 <= x && guiLeft + 111 + 16 > x && guiTop + i * 36 + 54 < y && guiTop + i * 36 + 54 + 16 >= y) {
if(guiLeft + 111 <= x && guiLeft + 111 + 16 > x && guiTop + i * 54 + 54 < y && guiTop + i * 54 + 54 + 16 >= y) {
this.active[i] = !this.active[i];
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F + (this.active[i] ? 0.25F : 0F)));
return;
}
if(guiLeft + 128 <= x && guiLeft + 128 + 18 > x && guiTop + i * 36 + 53 < y && guiTop + i * 36 + 53 + 18 >= y) {
if(guiLeft + 128 <= x && guiLeft + 128 + 18 > x && guiTop + i * 54 + 53 < y && guiTop + i * 54 + 53 + 18 >= y) {
this.polling[i] = !this.polling[i];
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F + (this.polling[i] ? 0.25F : 0F)));
return;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB