Skip to content

Commit b436cc5

Browse files
authored
fix "List is empty" string being neither expanded nor collapsed correctly (#314)
1 parent e0c9a70 commit b436cc5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ public EmptyListLabel(ListGroupSeparatorEntry parent, ConfigCategory category) {
630630

631631
@Override
632632
public void renderContent(GuiGraphics graphics, int mouseX, int mouseY, boolean hovered, float deltaTicks) {
633+
if (!this.isViewable()) {
634+
return;
635+
}
636+
633637
graphics.drawCenteredString(Minecraft.getInstance().font, Component.translatable("yacl.list.empty").withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC), this.getX() + this.getWidth() / 2, this.getY(), -1);
634638
}
635639

@@ -643,6 +647,12 @@ public boolean isViewable() {
643647
return parent.isExpanded() && super.isViewable();
644648
}
645649

650+
@Override
651+
protected void onBecameViewable() {
652+
super.onBecameViewable();
653+
setHeight(11);
654+
}
655+
646656
@Override
647657
protected void onBecameHidden() {
648658
super.onBecameHidden();

0 commit comments

Comments
 (0)