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 27b2e68..30ca61a 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 @@ -20,6 +20,8 @@ import net.minecraft.client.Minecraft import net.minecraft.network.chat.TranslatableComponent import org.jetbrains.annotations.ApiStatus import org.lwjgl.opengl.GL20 +import java.util.TreeSet +import kotlin.collections.LinkedHashSet @ApiStatus.Internal class ClickBox( @@ -28,7 +30,10 @@ class ClickBox( val name: TranslatableComponent = MissingComponent ): ColoredElement(x, y, 80, 10, color, 0.5F) { fun isCategory(c: Category): Boolean = (name.key == c.translationKey) - val buttons: MutableSet = if (sortAlphabetically) sortedSetOf(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) else mutableSetOf() + val buttons: MutableSet = + if (sortAlphabetically) + TreeSet(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) + else LinkedHashSet() override fun display(stack: PoseStack?) { hidden = buttons.isEmpty() || hidden super.display(stack)