Make ClickBox.buttons a map

This commit is contained in:
Username404-59 2021-05-01 20:18:46 +02:00
parent 8a65839816
commit 9dc097d32f
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 3 deletions

View File

@ -15,9 +15,9 @@ import org.lwjgl.opengl.GL20
class ClickBox(
x: Double, y: Double,
private val name: TranslatableComponent? = null,
val buttons: MutableCollection<ClickButton> = mutableSetOf()
private val name: TranslatableComponent? = null
): ColoredElement(x, y, 80, 10, 0x6C9E9D, 0.5F) {
val buttons = mutableMapOf<String, ClickButton>()
@JvmField
val scrollBar: ColoredElement = object: ColoredElement(
(x + width), y + height + 3,
@ -70,7 +70,7 @@ class ClickBox(
x = this@ClickBox.x + this@ClickBox.width - 3
y = this@ClickBox.y + this@ClickBox.height + 3
}.display(poseStack)
buttons.forEachIndexed { num, it ->
buttons.values.forEachIndexed { num, it ->
it.apply {
it.x = this@ClickBox.x + 3
it.y = this@ClickBox.y + 5 + height + (num * 9)