diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-01-25 02:19:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 02:19:48 +0100 |
commit | d25cfef7963debcf4adbcec7d086443132b6a213 (patch) | |
tree | 15347ecc0b493016bbfffbdc8f1dd85229fc61b8 /src | |
parent | 56a77d2b1767d7b3d88bb726ae6af5daab43f02c (diff) | |
download | skyhanni-d25cfef7963debcf4adbcec7d086443132b6a213.tar.gz skyhanni-d25cfef7963debcf4adbcec7d086443132b6a213.tar.bz2 skyhanni-d25cfef7963debcf4adbcec7d086443132b6a213.zip |
Red Number Scoreboard Hider (#10)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
3 files changed, 29 insertions, 0 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 12df4bca4..40ecb5f8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -167,4 +167,9 @@ public class Misc { @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; + + @Expose + @ConfigOption(name = "Red Scoreboard Numbers", desc = "Hide the red scoreboard numbers at the right side of the screen.") + @ConfigEditorBoolean + public boolean hideScoreboardNumbers = false; }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java new file mode 100644 index 000000000..6a40eb2cf --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiIngame.java @@ -0,0 +1,23 @@ +package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.SkyHanniMod; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiIngame; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(GuiIngame.class) +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); + } +} diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json index 337fe91de..7fe2496a2 100644 --- a/src/main/resources/mixins.skyhanni.json +++ b/src/main/resources/mixins.skyhanni.json @@ -17,6 +17,7 @@ "tileentity.TileEntitySignMixin" ], "client": [ + "MixinGuiIngame", "gui.MixinGuiNewChat" ] } |