Create a LinkedHashSet directly in ClickBox.kt and make a TreeSet instance instead of using sortedSetOf()
This commit is contained in:
parent
1d22337e5d
commit
cd4d25951c
|
@ -20,6 +20,8 @@ import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.network.chat.TranslatableComponent
|
import net.minecraft.network.chat.TranslatableComponent
|
||||||
import org.jetbrains.annotations.ApiStatus
|
import org.jetbrains.annotations.ApiStatus
|
||||||
import org.lwjgl.opengl.GL20
|
import org.lwjgl.opengl.GL20
|
||||||
|
import java.util.TreeSet
|
||||||
|
import kotlin.collections.LinkedHashSet
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
class ClickBox(
|
class ClickBox(
|
||||||
|
@ -28,7 +30,10 @@ class ClickBox(
|
||||||
val name: TranslatableComponent = MissingComponent
|
val name: TranslatableComponent = MissingComponent
|
||||||
): ColoredElement(x, y, 80, 10, color, 0.5F) {
|
): ColoredElement(x, y, 80, 10, color, 0.5F) {
|
||||||
fun isCategory(c: Category): Boolean = (name.key == c.translationKey)
|
fun isCategory(c: Category): Boolean = (name.key == c.translationKey)
|
||||||
val buttons: MutableSet<ButtonImpl> = if (sortAlphabetically) sortedSetOf(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) else mutableSetOf()
|
val buttons: MutableSet<ButtonImpl> =
|
||||||
|
if (sortAlphabetically)
|
||||||
|
TreeSet(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title })
|
||||||
|
else LinkedHashSet()
|
||||||
override fun display(stack: PoseStack?) {
|
override fun display(stack: PoseStack?) {
|
||||||
hidden = buttons.isEmpty() || hidden
|
hidden = buttons.isEmpty() || hidden
|
||||||
super.display(stack)
|
super.display(stack)
|
||||||
|
|
Loading…
Reference in New Issue