From 8fbe2ecabe6330195911b6bcca122b42a2767ebc Mon Sep 17 00:00:00 2001 From: WHR Date: Tue, 20 Oct 2020 17:03:18 +0800 Subject: [PATCH] Fix main menu button texts not aligned with unicode font --- .../client/gui/menu/AetherMainMenu.java | 10 +++++----- .../client/gui/menu/AetherMainMenuButton.java | 17 +++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenu.java b/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenu.java index 1b2d8be..1fdfb00 100644 --- a/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenu.java +++ b/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenu.java @@ -183,14 +183,14 @@ public class AetherMainMenu extends GuiMainMenu private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) { - this.buttonList.add(new AetherMainMenuButton(1, 30, p_73969_1_, 200, 20, 35, I18n.format("menu.singleplayer", new Object[0]))); + this.buttonList.add(new AetherMainMenuButton(1, 30, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); this.buttonList.add(new AetherMainMenuButton(2, 30, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); - GuiButton realmsButton = new AetherMainMenuButton(14, 30, p_73969_1_ + p_73969_2_ * 2, 200, 20, 24, I18n.format("menu.online", new Object[0])); - GuiButton fmlModButton = new AetherMainMenuButton(6, 30, p_73969_1_ + p_73969_2_ * 3, 200, 20, 54, "Mods"); + GuiButton realmsButton = new AetherMainMenuButton(14, 30, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0])); + GuiButton fmlModButton = new AetherMainMenuButton(6, 30, p_73969_1_ + p_73969_2_ * 3, "Mods"); this.buttonList.add(realmsButton); this.buttonList.add(fmlModButton); - this.buttonList.add(new AetherMainMenuButton(0, 30, p_73969_1_ + p_73969_2_ * 4, 200, 20, 45, I18n.format("menu.options", new Object[0]))); - this.buttonList.add(new AetherMainMenuButton(4,30, p_73969_1_ + p_73969_2_ * 5, 200, 20, 43, I18n.format("menu.quit", new Object[0]))); + this.buttonList.add(new AetherMainMenuButton(0, 30, p_73969_1_ + p_73969_2_ * 4, I18n.format("menu.options", new Object[0]))); + this.buttonList.add(new AetherMainMenuButton(4,30, p_73969_1_ + p_73969_2_ * 5, I18n.format("menu.quit", new Object[0]))); } @Override diff --git a/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenuButton.java b/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenuButton.java index a3393b1..80f6ba2 100644 --- a/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenuButton.java +++ b/src/main/java/com/gildedgames/the_aether/client/gui/menu/AetherMainMenuButton.java @@ -10,17 +10,15 @@ import org.lwjgl.opengl.GL11; public class AetherMainMenuButton extends GuiButton { protected static final ResourceLocation buttonTextures = new ResourceLocation("aether_legacy", "textures/gui/menu/buttons.png"); - private int textOffset; public AetherMainMenuButton(int buttonId, int x, int y, String buttonText) { - this(buttonId, x, y, 200, 20, 39, buttonText); + this(buttonId, x, y, 200, 20, buttonText); } - public AetherMainMenuButton(int buttonId, int x, int y, int widthIn, int heightIn, int textOffset, String buttonText) + public AetherMainMenuButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) { super(buttonId, x, y, widthIn, heightIn, buttonText); - this.textOffset = textOffset; } @Override @@ -39,22 +37,21 @@ public class AetherMainMenuButton extends GuiButton this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_); - int l = 14737632; - + int text_color = 0xe0e0e0; if (packedFGColour != 0) { - l = packedFGColour; + text_color = packedFGColour; } else if (!this.enabled) { - l = 10526880; + text_color = 0xa0a0a0; } else if (this.field_146123_n) { - l = 7851212; + text_color = 0x77cccc; } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + (this.width / 2) - this.textOffset, this.yPosition + (this.height - 8) / 2, l); + this.drawString(fontrenderer, this.displayString, this.xPosition + 32, this.yPosition + (this.height - 8) / 2, text_color); } } }