From 8bf84fcf2dcb43f3d5232380bd1ce2bb06b378d6 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 20 Jan 2024 20:09:35 -0500 Subject: [PATCH] fix: inline NetworkPlayerInfo.text to prevent bad mixins from altering data --- .../kotlin/gg/skytils/skytilsmod/utils/TabListUtils.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/utils/TabListUtils.kt b/src/main/kotlin/gg/skytils/skytilsmod/utils/TabListUtils.kt index aa72ea7ea..1d1bce47a 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/utils/TabListUtils.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/utils/TabListUtils.kt @@ -21,10 +21,15 @@ import com.google.common.collect.ComparisonChain import com.google.common.collect.Ordering import gg.skytils.skytilsmod.Skytils.Companion.mc import net.minecraft.client.network.NetworkPlayerInfo +import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraft.world.WorldSettings val NetworkPlayerInfo.text: String - get() = mc.ingameGUI.tabList.getPlayerName(this) + get() = displayName?.formattedText ?: ScorePlayerTeam.formatPlayerName( + playerTeam, + gameProfile.name + ) + object TabListUtils { private val playerInfoOrdering = object : Ordering() { @@ -39,6 +44,7 @@ object TabListUtils { p2.playerTeam?.registeredName ?: "" ).compare(p1.gameProfile.name, p2.gameProfile.name).result() } + p1 == null -> -1 else -> 0 }