mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Numitron GUI
This commit is contained in:
parent
93a159c342
commit
820da70e5f
@ -48,9 +48,9 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
|
||||
int oY = 4;
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);
|
||||
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 85 - 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 * 54, 72 - oX * 2, 14);
|
||||
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 85 - oX * 2, 14);
|
||||
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, display.displays[i].rtty);
|
||||
|
||||
active[i] = display.displays[i].active;
|
||||
@ -80,8 +80,10 @@ 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 * 54 + 54, 18, 150, 16, 16);
|
||||
if(this.polling[i]) drawTexturedModalRect(guiLeft + 128, guiTop + i * 54 + 53, 0, 150, 18, 18);
|
||||
if(this.active[i]) drawTexturedModalRect(guiLeft + 124, guiTop + i * 54 + 54, 18, 150, 16, 16);
|
||||
if(this.polling[i]) drawTexturedModalRect(guiLeft + 159, guiTop + i * 54 + 53, 0, 150, 18, 18);
|
||||
if(this.shorten_number[i]) drawTexturedModalRect(guiLeft + 195, guiTop + i * 54 + 53, 34, 150, 18, 18);
|
||||
if(this.leading_zeroes[i]) drawTexturedModalRect(guiLeft + 231, guiTop + i * 54 + 53, 52, 150, 18, 18);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
@ -95,17 +97,29 @@ 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 * 54 + 54 < y && guiTop + i * 54 + 54 + 16 >= y) {
|
||||
if(guiLeft + 124 <= x && guiLeft + 124 + 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 * 54 + 53 < y && guiTop + i * 54 + 53 + 18 >= y) {
|
||||
if(guiLeft + 159 <= x && guiLeft + 159 + 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;
|
||||
}
|
||||
|
||||
if(guiLeft + 195 <= x && guiLeft + 195 + 18 > x && guiTop + i * 54 + 53 < y && guiTop + i * 54 + 53 + 18 >= y) {
|
||||
this.shorten_number[i] = !this.shorten_number[i];
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F + (this.shorten_number[i] ? 0.25F : 0F)));
|
||||
return;
|
||||
}
|
||||
|
||||
if(guiLeft + 231 <= x && guiLeft + 231 + 18 > x && guiTop + i * 54 + 53 < y && guiTop + i * 54 + 53 + 18 >= y) {
|
||||
this.leading_zeroes[i] = !this.leading_zeroes[i];
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F + (this.leading_zeroes[i] ? 0.25F : 0F)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(guiLeft + 209 <= x && guiLeft + 209 + 18 > x && guiTop + 17 < y && guiTop + 17 + 18 >= y) {
|
||||
@ -113,12 +127,18 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
byte active = 0;
|
||||
byte polling = 0;
|
||||
byte shorten_number = 0;
|
||||
byte leading_zeroes = 0;
|
||||
for(int i = 0; i < 2; i++) {
|
||||
if(this.active[i]) active |= 1 << i;
|
||||
if(this.polling[i]) polling |= 1 << i;
|
||||
if(this.shorten_number[i]) shorten_number |= 1 << i;
|
||||
if(this.leading_zeroes[i]) leading_zeroes |= 1 << i;
|
||||
}
|
||||
data.setByte("active", active);
|
||||
data.setByte("polling", polling);
|
||||
data.setByte("shorten_number", shorten_number);
|
||||
data.setByte("leading_zeroes", leading_zeroes);
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
data.setString("label" + i, this.label[i].getText());
|
||||
|
||||
@ -179,9 +179,13 @@ public class TileEntityRBMKNumitron extends TileEntityLoadedBase implements IGUI
|
||||
|
||||
int active = data.getByte("active");
|
||||
int polling = data.getByte("polling");
|
||||
int shorten_number = data.getByte("shorten_number");
|
||||
int leading_zeroes = data.getByte("leading_zeroes");
|
||||
for(int i = 0; i < 2; i++) {
|
||||
this.displays[i].active = (active & (1 << i)) != 0;
|
||||
this.displays[i].polling = (polling & (1 << i)) != 0;
|
||||
this.displays[i].shorten_number = (shorten_number & (1 << i)) != 0;
|
||||
this.displays[i].leading_zeroes = (leading_zeroes & (1 << i)) != 0;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
Loading…
x
Reference in New Issue
Block a user