From 63a44abbdc1f245d81d873744c3de1a02e4e5037 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 27 Apr 2023 15:01:43 +0200 Subject: Replacing 'Piggy' with 'Purse' in the Scoreboard. --- .../skyhanni/mixins/hooks/GuiIngameHook.kt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt (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 new file mode 100644 index 000000000..424c3659f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt @@ -0,0 +1,29 @@ +package at.hannibal2.skyhanni.mixins.hooks + +import at.hannibal2.skyhanni.SkyHanniMod +import net.minecraft.client.gui.FontRenderer + +private val piggyPattern = "Piggy: (?.*)".toPattern() + +fun drawString( + instance: FontRenderer, + text: String, + x: Int, + y: Int, + color: Int, +): Int { + if (SkyHanniMod.feature.misc.hideScoreboardNumbers) { + if (text.startsWith("§c") && text.length <= 4) { + return 0 + } + } + if (SkyHanniMod.feature.misc.hidePiggyScoreboard) { + val matcher = piggyPattern.matcher(text) + if (matcher.matches()) { + val coins = matcher.group("coins") + return instance.drawString("Purse: $coins", x, y, color) + } + } + + return instance.drawString(text, x, y, color) +} -- cgit