diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt index a4a0054..5b91957 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt @@ -40,7 +40,7 @@ abstract class Element( } } } - fun display(stack: PoseStack? = null) { + open fun display(stack: PoseStack? = null) { if (!hidden && !caughtError) try { render(stack) } catch (t: Throwable) { diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt index 6501475..c365604 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt @@ -22,6 +22,10 @@ class ClickBox( val name: TranslatableComponent? = null ): ColoredElement(x, y, 80, 10, color, 0.5F) { val buttons = mutableSetOf() + override fun display(stack: PoseStack?) { + hidden = buttons.isEmpty() || hidden + super.display(stack) + } @JvmField val buttonsProgressBar: ColoredElement = object: ColoredElement( (x + width), y + height + 3,