Skip to content

Commit c9e278f

Browse files
committed
fix label styles appearing at first position before they are rendered
1 parent 732eb45 commit c9e278f

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/dev/isxander/yacl/gui/OptionListWidget.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ protected void renderBackground(MatrixStack matrices) {
216216

217217
public void recacheViewableChildren() {
218218
this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(Entry::isViewable).toList());
219+
220+
// update y positions before they need to be rendered are rendered
221+
int i = 0;
222+
for (Entry entry : viewableChildren) {
223+
if (entry instanceof OptionEntry optionEntry)
224+
optionEntry.widget.setDimension(optionEntry.widget.getDimension().setY(getRowTop(i)));
225+
i++;
226+
}
219227
}
220228

221229
@Override

src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ private Screen getFullTestSuite(Screen parent) {
7272
)
7373
.controller(BooleanController::new)
7474
.flag(OptionFlag.GAME_RESTART)
75+
.available(false)
7576
.build())
7677
.option(Option.createBuilder(boolean.class)
7778
.name(Text.of("Custom Boolean Toggle"))

0 commit comments

Comments
 (0)