From 4352ffb08d4bfffc06adad2a068f375ab9874333 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:59:55 +0100 Subject: Feature: CustomScoreboard (#893) Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: Thunderblade73 Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt index 9d1e7ab87..0bf44d0a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt @@ -15,11 +15,16 @@ fun drawString( x: Int, y: Int, color: Int, -) = replaceString(text)?.let { +) = tryToReplaceScoreboardLine(text)?.let { instance.drawString(it, x, y, color) } ?: 0 -private fun replaceString(text: String): String? { +/** + * Tries to replace a scoreboard line with a modified one + * @param text The line to check and possibly replace + * @return The replaced line, or null if it should be hidden + */ +fun tryToReplaceScoreboardLine(text: String): String? { if (SkyHanniMod.feature.misc.hideScoreboardNumbers && text.startsWith("§c") && text.length <= 4) { return null } -- cgit