Fix main menu button texts not aligned with unicode font

This commit is contained in:
WHR 2020-10-20 17:03:18 +08:00
parent 853bde6da8
commit 8fbe2ecabe
2 changed files with 12 additions and 15 deletions

View file

@ -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

View file

@ -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);
}
}
}