From 2a8ac10ec2d577233cdfd3ef3c8a09d4d0c39839 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sat, 28 Dec 2024 21:18:37 -0500 Subject: [PATCH] Fix incorrect widget layout due to mods updating renderables after initialization --- .../moulberry/flashback/mixin/ui/MixinTitleScreen.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/moulberry/flashback/mixin/ui/MixinTitleScreen.java b/src/main/java/com/moulberry/flashback/mixin/ui/MixinTitleScreen.java index e7d375e..3eb87f9 100644 --- a/src/main/java/com/moulberry/flashback/mixin/ui/MixinTitleScreen.java +++ b/src/main/java/com/moulberry/flashback/mixin/ui/MixinTitleScreen.java @@ -65,6 +65,14 @@ public class MixinTitleScreen extends Screen { for (int offsetX = 0; offsetX < 5; offsetX++) { for (int i = this.normalMenuWidgets.size()-1; i >= 0; i--) { AbstractWidget widget = this.normalMenuWidgets.get(i); + + // Some mods which add custom menu functionality will run TitleScreen#createNormalMenuOptions + // but then later clear all the renderables. Simple fix is to scan the renderables list to + // ensure that the normal menu widget is still actually present + if (!this.renderables.contains(widget)) { + continue; + } + int size = widget.getHeight(); int x = widget.getRight() + 4 + size * offsetX; int y = widget.getY();