From ee494c2d518c210952298368c3d67dcc25290ebb Mon Sep 17 00:00:00 2001 From: Sen Date: Thu, 4 Sep 2025 12:17:56 +0200 Subject: [PATCH] revert gui element height changes --- client/src/main/java/client/gui/GuiConsole.java | 1 - client/src/main/java/client/gui/GuiMenu.java | 1 - client/src/main/java/client/gui/GuiServer.java | 1 - .../java/client/gui/container/GuiContainer.java | 7 +++---- .../src/main/java/client/gui/ingame/GuiForm.java | 16 ++++++++-------- .../main/java/client/gui/ingame/GuiGameOver.java | 2 +- .../main/java/client/gui/ingame/GuiRename.java | 8 ++++---- .../src/main/java/client/gui/ingame/GuiSign.java | 10 +++++----- 8 files changed, 21 insertions(+), 25 deletions(-) diff --git a/client/src/main/java/client/gui/GuiConsole.java b/client/src/main/java/client/gui/GuiConsole.java index 89b8db8d..ffecb538 100644 --- a/client/src/main/java/client/gui/GuiConsole.java +++ b/client/src/main/java/client/gui/GuiConsole.java @@ -6,7 +6,6 @@ import client.Client; import client.gui.element.ActButton; import client.gui.element.Area; import client.gui.element.ButtonCallback; -import client.gui.element.Element; import client.gui.element.Fill; import client.gui.element.PressType; import client.renderer.Drawing; diff --git a/client/src/main/java/client/gui/GuiMenu.java b/client/src/main/java/client/gui/GuiMenu.java index 410a635b..80f156a6 100644 --- a/client/src/main/java/client/gui/GuiMenu.java +++ b/client/src/main/java/client/gui/GuiMenu.java @@ -5,7 +5,6 @@ import client.gui.character.GuiChar; import client.gui.character.GuiCharacters; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; -import client.gui.element.Element; import client.gui.element.Label; import client.gui.element.NavButton; import client.gui.element.PressType; diff --git a/client/src/main/java/client/gui/GuiServer.java b/client/src/main/java/client/gui/GuiServer.java index 73a11c7c..5054f57d 100644 --- a/client/src/main/java/client/gui/GuiServer.java +++ b/client/src/main/java/client/gui/GuiServer.java @@ -5,7 +5,6 @@ import java.security.PublicKey; import client.gui.GuiConnect.ServerInfo; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; -import client.gui.element.Element; import client.gui.element.Label; import client.gui.element.NavButton; import client.gui.element.PasswordField; diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index abf01676..87f78167 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -102,7 +102,6 @@ public abstract class GuiContainer extends Gui private int cheatWidth; private int cheatHeight; private Label cheatLabel; - private MultiLabel cheatDesc; private Field cheatSearch; private String cheatLast; @@ -293,7 +292,7 @@ public abstract class GuiContainer extends Gui this.cheatX = this.container_x + this.container_w + 4; this.cheatY = 16; this.cheatWidth = Math.max((this.gm.fbX - this.container_x - this.container_w - 16) / 18, 1); - this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 100) / 18, 1); + this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 46) / 18, 1); } } @@ -307,8 +306,8 @@ public abstract class GuiContainer extends Gui } if(this.gm.itemCheat) { this.cheatLabel = this.add(new FontLabel(this.cheatX, this.cheatY, this.cheatWidth * 18, Font.SMALL, "", true)); - this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)")); - this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18, 0, 128, null, "")); +// this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)")); + this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18 + 10, 0, 128, null, "")); this.cheatLast = ""; for(CheatTab tab : CheatTab.values()) { this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, false, null)); diff --git a/client/src/main/java/client/gui/ingame/GuiForm.java b/client/src/main/java/client/gui/ingame/GuiForm.java index ef5c53b2..e10ad403 100644 --- a/client/src/main/java/client/gui/ingame/GuiForm.java +++ b/client/src/main/java/client/gui/ingame/GuiForm.java @@ -32,14 +32,14 @@ public class GuiForm extends Gui implements ButtonCallback { private boolean sent; public void init(int width, int height) { - this.add(new Label(0, -100, 300, 0, this.title)); + this.add(new Label(0, -100, 0, 0, this.title)); for(int z = 0; z < this.inputs.length; z++) { final int index = z; final String name = this.inputData[z].first(); Object obj = this.inputData[z].second(); int param = this.inputData[z].third(); if(obj instanceof Boolean bool) { - this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 0, bool, bool, new ToggleCallback() { + this.inputs[z] = this.add(new Toggle(0, 50 * z, 0, 0, bool, bool, new ToggleCallback() { public void use(Toggle elem, boolean value) { GuiForm.this.outputData[index] = value; } @@ -47,7 +47,7 @@ public class GuiForm extends Gui implements ButtonCallback { } else if(obj instanceof String[] strs) { param = ExtMath.clampi(param, 0, strs.length - 1); - this.inputs[z] = this.add(new Switch(0, 50 * z, 300, 0, strs, strs[param], strs[param], new SwitchCallback() { + this.inputs[z] = this.add(new Switch(0, 50 * z, 0, 0, strs, strs[param], strs[param], new SwitchCallback() { public void use(Switch elem, String value) { for(int n = 0; n < strs.length; n++) { if(value == strs[n]) { @@ -59,19 +59,19 @@ public class GuiForm extends Gui implements ButtonCallback { }, name)); } else { - this.labels[z] = this.add(new Label(0, 50 * z, 300, name, true)); + this.labels[z] = this.add(new Label(0, 50 * z, 0, name, true)); FieldCallback callback = new FieldCallback() { public void use(Field elem, FieldAction value) { if(value == FieldAction.FOCUS) GuiForm.this.labels[index].setText(name); } }; - this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj) : - new Field(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj)); + this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 0, 0, Math.min(param & 0xffff, 1024), callback, (String)obj) : + new Field(0, 50 * z, 0, 0, Math.min(param & 0xffff, 1024), callback, (String)obj)); } } - this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 0, null, "Abbrechen")); - this.add(new ActButton(152, 50 * (this.inputs.length + 1), 148, 0, this, "Senden")); + this.add(new NavButton(0, 50 * (this.inputs.length + 1), (BASE_WIDTH - BASE_GAP) / 2, 0, null, "Abbrechen")); + this.add(new ActButton((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP, 50 * (this.inputs.length + 1), (BASE_WIDTH - BASE_GAP) / 2, 0, this, "Senden")); this.shift(); } diff --git a/client/src/main/java/client/gui/ingame/GuiGameOver.java b/client/src/main/java/client/gui/ingame/GuiGameOver.java index 608cb5de..0fa03527 100755 --- a/client/src/main/java/client/gui/ingame/GuiGameOver.java +++ b/client/src/main/java/client/gui/ingame/GuiGameOver.java @@ -22,7 +22,7 @@ public class GuiGameOver extends Gui { this.timer = 0; this.add(new Label(0, 0, 400, 0, Color.DARK_RED + "Du bist gestorben!")); this.add(new MultiLabel(0, 32, 400, 42, String.format(Color.GREEN + "Letzte Position" + Color.GRAY + ":\n" + Color.YELLOW + "%d, %d, %d\n" + Color.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getDisplay()))); - this.button = this.add(new ActButton(100, 100, 200, 0, new ButtonCallback() { + this.button = this.add(new ActButton((400 - BASE_WIDTH) / 2, 100, 0, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiGameOver.this.gm.player.respawnPlayer(); GuiGameOver.this.gm.show(null); diff --git a/client/src/main/java/client/gui/ingame/GuiRename.java b/client/src/main/java/client/gui/ingame/GuiRename.java index ae783d51..e138a362 100644 --- a/client/src/main/java/client/gui/ingame/GuiRename.java +++ b/client/src/main/java/client/gui/ingame/GuiRename.java @@ -24,10 +24,10 @@ public class GuiRename extends Gui implements FieldCallback, ButtonCallback { private ActButton button; public void init(int width, int height) { - this.add(new Label(0, -140, 300, 0, "Benenne " + this.itemName + " um")); - this.lines = this.add(new Field(0, 0, 300, 0, 50, this, this.origName)); - this.add(new NavButton(0, 40, 149, 0, this.previous, "Abbrechen")); - this.button = this.add(new ActButton(151, 40, 149, 0, this, "Umbenennen")); + this.add(new Label(0, -140, 0, 0, "Benenne " + this.itemName + " um")); + this.lines = this.add(new Field(0, 0, 0, 0, 50, this, this.origName)); + this.add(new NavButton(0, 40, (BASE_WIDTH - BASE_GAP) / 2, 0, this.previous, "Abbrechen")); + this.button = this.add(new ActButton((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP, 40, (BASE_WIDTH - BASE_GAP) / 2, 0, this, "Umbenennen")); this.shift(); } diff --git a/client/src/main/java/client/gui/ingame/GuiSign.java b/client/src/main/java/client/gui/ingame/GuiSign.java index df5d6e54..23138e51 100644 --- a/client/src/main/java/client/gui/ingame/GuiSign.java +++ b/client/src/main/java/client/gui/ingame/GuiSign.java @@ -16,13 +16,13 @@ public class GuiSign extends Gui implements FieldCallback { private final String[] tempLines; public void init(int width, int height) { - this.add(new Label(0, -140, 300, 0, "Bearbeite Schild")); - this.add(new Label(0, -80, 300, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ()))); - this.add(new Label(0, -50, 300, 0, this.gm.world == null ? "" : this.gm.world.dimension.getDisplay())); + this.add(new Label(0, -140, 0, 0, "Bearbeite Schild")); + this.add(new Label(0, -80, 0, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ()))); + this.add(new Label(0, -50, 0, 0, this.gm.world == null ? "" : this.gm.world.dimension.getDisplay())); for(int z = 0; z < this.lines.length; z++) { - this.lines[z] = this.add(new Field(0, 40 * z, 300, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z])); + this.lines[z] = this.add(new Field(0, 40 * z, 0, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z])); } - this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 0, null, "Fertig")); + this.add(new NavButton(0, 40 * (this.lines.length + 1), 0, 0, null, "Fertig")); this.shift(); }