diff options
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/OptionListWidget.java | 8 | ||||
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java index 6dba77e..ddbb06e 100644 --- a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java +++ b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java @@ -216,6 +216,14 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry> public void recacheViewableChildren() { this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(Entry::isViewable).toList()); + + // update y positions before they need to be rendered are rendered + int i = 0; + for (Entry entry : viewableChildren) { + if (entry instanceof OptionEntry optionEntry) + optionEntry.widget.setDimension(optionEntry.widget.getDimension().setY(getRowTop(i))); + i++; + } } @Override diff --git a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java index 80db142..d1bd2c5 100644 --- a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java +++ b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java @@ -72,6 +72,7 @@ public class ModMenuIntegration implements ModMenuApi { ) .controller(BooleanController::new) .flag(OptionFlag.GAME_RESTART) + .available(false) .build()) .option(Option.createBuilder(boolean.class) .name(Text.of("Custom Boolean Toggle")) |