Skip to content

Commit bfa093d

Browse files
committed
Fix Server Links button on top of Mods button in Insert mode
- Fixed "Server Links" button overlapping Mods button in "Insert" mode
1 parent fc50c22 commit bfa093d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/java/com/terraformersmc/modmenu/event/ModMenuEventHandler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import net.minecraft.text.TranslatableTextContent;
2525
import net.minecraft.util.Identifier;
2626

27+
import java.util.Arrays;
2728
import java.util.List;
2829

2930
public class ModMenuEventHandler {
@@ -133,12 +134,13 @@ private static void onClientEndTick(MinecraftClient client) {
133134
}
134135
}
135136

136-
public static boolean buttonHasText(Widget widget, String translationKey) {
137+
public static boolean buttonHasText(Widget widget, String... translationKeys) {
137138
if (widget instanceof ButtonWidget button) {
138139
Text text = button.getMessage();
139140
TextContent textContent = text.getContent();
140-
return textContent instanceof TranslatableTextContent &&
141-
((TranslatableTextContent) textContent).getKey().equals(translationKey);
141+
142+
return textContent instanceof TranslatableTextContent && Arrays.stream(translationKeys)
143+
.anyMatch(s -> ((TranslatableTextContent) textContent).getKey().equals(s));
142144
}
143145
return false;
144146
}

src/main/java/com/terraformersmc/modmenu/mixin/MixinGameMenu.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private void onInitWidgets(CallbackInfo ci, GridWidget gridWidget, GridWidget.Ad
4343
Widget widget = buttons.get(i);
4444
if (style == ModMenuConfig.GameMenuButtonStyle.INSERT) {
4545
if (!(widget instanceof ClickableWidget button) || button.visible) {
46-
ModMenuEventHandler.shiftButtons(widget, modsButtonIndex == -1 || ModMenuEventHandler.buttonHasText(widget, "menu.reportBugs"), spacing);
46+
ModMenuEventHandler.shiftButtons(widget, modsButtonIndex == -1 || ModMenuEventHandler.buttonHasText(widget, "menu.reportBugs", "menu.server_links"), spacing);
4747
if (modsButtonIndex == -1) {
4848
buttonsY = widget.getY();
4949
}

0 commit comments

Comments
 (0)