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 645c223..9a264f4 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 @@ -24,8 +24,8 @@ import kotlin.collections.LinkedHashSet @ApiStatus.Internal class ClickBox( x: Double, y: Double, - override var color: Int = Colors.BLUE.hexValue, - val name: Component = MissingComponent + val name: Component = MissingComponent, + override var color: Int = savedColors?.get(name.string) ?: Colors.BLUE.hexValue, ): ColoredElement(x, y, 80, 10, color, 0.5F) { fun isCategory(c: Category): Boolean = (name.string == c.box.name.string) val buttons: MutableSet = @@ -119,9 +119,4 @@ class ClickBox( Minecraft.getInstance().font.draw(poseStack, name.string, x.toFloat() + 5, y.toFloat() + 1.5F, Colors.TRANSPARENT.hexValue) } } - init { - savedColors?.get(name.string)?.let { - this.color = it - } - } }