aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java10
3 files changed, 36 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
index 23a9824a9..b9a79ce0d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
@@ -303,6 +303,11 @@ public class Misc {
public boolean hideScoreboardNumbers = false;
@Expose
+ @ConfigOption(name = "Hide Piggy", desc = "Replacing 'Piggy' with 'Purse' in the Scoreboard.")
+ @ConfigEditorBoolean
+ public boolean hidePiggyScoreboard = true;
+
+ @Expose
@ConfigOption(name = "Explosions Hider", desc = "Hide explosions.")
@ConfigEditorBoolean
public boolean hideExplosions = false;
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)
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java
index 6a40eb2cf..6dece8c10 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.mixins.transformers;
-import at.hannibal2.skyhanni.SkyHanniMod;
+import at.hannibal2.skyhanni.mixins.hooks.GuiIngameHookKt;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiIngame;
import org.spongepowered.asm.mixin.Mixin;
@@ -12,12 +12,6 @@ public class MixinGuiIngame {
@Redirect(method = "renderScoreboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I"))
private int renderItemOverlayPost(FontRenderer instance, String text, int x, int y, int color) {
- if (SkyHanniMod.feature.misc.hideScoreboardNumbers) {
- if (text.startsWith("§c") && text.length() <= 4) {
- return 0;
- }
- }
-
- return instance.drawString(text, x, y, color);
+ return GuiIngameHookKt.drawString(instance, text, x, y, color);
}
}