Only show ClickBoxes when they have buttons
This commit is contained in:
parent
d33622b850
commit
a973d8c001
common/src/main/kotlin/fr/username404/snowygui/gui
|
@ -40,7 +40,7 @@ abstract class Element(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun display(stack: PoseStack? = null) {
|
open fun display(stack: PoseStack? = null) {
|
||||||
if (!hidden && !caughtError) try {
|
if (!hidden && !caughtError) try {
|
||||||
render(stack)
|
render(stack)
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
|
|
|
@ -22,6 +22,10 @@ class ClickBox(
|
||||||
val name: TranslatableComponent? = null
|
val name: TranslatableComponent? = null
|
||||||
): ColoredElement(x, y, 80, 10, color, 0.5F) {
|
): ColoredElement(x, y, 80, 10, color, 0.5F) {
|
||||||
val buttons = mutableSetOf<ColoredElement>()
|
val buttons = mutableSetOf<ColoredElement>()
|
||||||
|
override fun display(stack: PoseStack?) {
|
||||||
|
hidden = buttons.isEmpty() || hidden
|
||||||
|
super.display(stack)
|
||||||
|
}
|
||||||
@JvmField
|
@JvmField
|
||||||
val buttonsProgressBar: ColoredElement = object: ColoredElement(
|
val buttonsProgressBar: ColoredElement = object: ColoredElement(
|
||||||
(x + width), y + height + 3,
|
(x + width), y + height + 3,
|
||||||
|
|
Loading…
Reference in New Issue