summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins/hooks
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-27 15:01:43 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-27 15:01:43 +0200
commit63a44abbdc1f245d81d873744c3de1a02e4e5037 (patch)
tree298f8ec34ef1d8f6ca45b81ae59b0a454ad49246 /src/main/java/at/hannibal2/skyhanni/mixins/hooks
parent3a950dcbc451697ee4ef3eaa4b1df6195b865786 (diff)
downloadskyhanni-63a44abbdc1f245d81d873744c3de1a02e4e5037.tar.gz
skyhanni-63a44abbdc1f245d81d873744c3de1a02e4e5037.tar.bz2
skyhanni-63a44abbdc1f245d81d873744c3de1a02e4e5037.zip
Replacing 'Piggy' with 'Purse' in the Scoreboard.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt29
1 files changed, 29 insertions, 0 deletions
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: (?<coins>.*)".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)
+}