From f4979bfa9442e88d9832bc46f7fb1c314c95224b Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 29 May 2021 13:57:09 +0200 Subject: [PATCH] Position clickboxes correctly when riskyCheats is false --- .../fr/username404/snowygui/gui/elements/ClickBox.kt | 4 +--- .../snowygui/gui/feature/ButtonAnnotations.kt | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) 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 0e7694a..05a6693 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 @@ -17,7 +17,7 @@ import org.lwjgl.opengl.GL20 @ApiStatus.Internal class ClickBox( - x: Double = baseXAxis, y: Double, + x: Double, y: Double, color: Colors = Colors.BLUE, val name: TranslatableComponent? = null ): ColoredElement(x, y, 80, 10, color, 0.5F) { @@ -57,7 +57,6 @@ class ClickBox( } companion object { - var baseXAxis: Double = 4.0; private set const val clickboxHeightOffset: Int = 80 private const val inclination: Double = 2.5 } @@ -109,5 +108,4 @@ class ClickBox( } } } - init { baseXAxis += 86 } } diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonAnnotations.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonAnnotations.kt index 51f4d63..899549a 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonAnnotations.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonAnnotations.kt @@ -24,7 +24,15 @@ annotation class ButtonInfo( MISC("snowy.clickbox.misc", Colors.BLUE), RISKY("snowy.clickbox.risky", Colors.RED), MACROS("snowy.clickbox.macros", Colors.GREEN); - init { ClickGui.components.add(ClickBox(y = 4.0, name = TranslatableComponent(translationKey), color = categoryColor)) } + init { + ClickGui.components.add( + ClickBox( + x = 4.0 + (if (ordinal >= 1 && !riskyCheats) ordinal - 1 else ordinal) * 86, y = 4.0, + name = TranslatableComponent(translationKey), + color = categoryColor + ) + ) + } } /**