From ea0bbf77a57cdb0325ecd3a719ddd335f45e2983 Mon Sep 17 00:00:00 2001 From: zeng-git <95841646+zeng-github01@users.noreply.github.com> Date: Sat, 9 Nov 2024 07:53:55 +0800 Subject: [PATCH] Fix --- .../appeng/client/gui/implementations/GuiInterface.java | 3 +-- src/main/java/appeng/client/gui/widgets/GuiImgLabel.java | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterface.java b/src/main/java/appeng/client/gui/implementations/GuiInterface.java index 2b57c59a999..9632a90ab87 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterface.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterface.java @@ -75,11 +75,10 @@ protected void addButtons() { } protected void addLabel() { - this.lockReason = new GuiImgLabel(this.fontRenderer, guiLeft + 50, guiTop + 12, Settings.UNLOCK, LockCraftingMode.NONE); + this.lockReason = new GuiImgLabel(this.fontRenderer, guiLeft + 40, guiTop + 12, Settings.UNLOCK, LockCraftingMode.NONE); labelList.add(lockReason); } - @Override public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) { if (this.BlockMode != null) { diff --git a/src/main/java/appeng/client/gui/widgets/GuiImgLabel.java b/src/main/java/appeng/client/gui/widgets/GuiImgLabel.java index bbcc004a7c2..ffba24eba60 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiImgLabel.java +++ b/src/main/java/appeng/client/gui/widgets/GuiImgLabel.java @@ -56,7 +56,9 @@ public void drawLabel(Minecraft mc, int mouseX, int mouseY) { if (labelSetting != null && currentValue != null) { LabelAppearance labelAppearance = appearances.get(new GuiImgButton.EnumPair(this.labelSetting, this.currentValue)); - fontRenderer.drawString(I18n.translateToLocal(labelAppearance.displayLabel), x + 16, y + 5, labelAppearance.color); + String translated = I18n.translateToLocal(labelAppearance.displayLabel); + fontRenderer.drawString(translated, x + 16, y + 5, labelAppearance.color); + width = 16 + fontRenderer.getStringWidth(translated); } } } @@ -118,12 +120,12 @@ public int yPos() { @Override public int getWidth() { - return 16; + return width; } @Override public int getHeight() { - return 16; + return height; } @Override