Only show ClickBoxes when they have buttons

This commit is contained in:
Username404 2021-05-23 11:10:43 +02:00
parent d33622b850
commit a973d8c001
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 5 additions and 1 deletions

View File

@ -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) {

View File

@ -22,6 +22,10 @@ class ClickBox(
val name: TranslatableComponent? = null
): ColoredElement(x, y, 80, 10, color, 0.5F) {
val buttons = mutableSetOf<ColoredElement>()
override fun display(stack: PoseStack?) {
hidden = buttons.isEmpty() || hidden
super.display(stack)
}
@JvmField
val buttonsProgressBar: ColoredElement = object: ColoredElement(
(x + width), y + height + 3,