aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-09 22:12:27 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-09 22:12:27 +0200
commitdce5a156849a3ba1b09e28dbfc153fc14a7f7b2c (patch)
treeb51bffce829a14ed1bdccb581acec2dd1838540e /src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
parent9d2b7bec68f98228acf913f029f0383e4dcff3d7 (diff)
downloadDulkirMod-Fabric-master.tar.gz
DulkirMod-Fabric-master.tar.bz2
DulkirMod-Fabric-master.zip
Port to 1.20.6HEADmaster
Diffstat (limited to 'src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
index 995b8af..7ab1671 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
@@ -3,14 +3,14 @@ package com.dulkirfabric.mixin.render;
import com.dulkirfabric.config.DulkirConfig;
import com.dulkirfabric.util.Utils;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
-import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
-import net.minecraft.text.Text;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.scoreboard.number.BlankNumberFormat;
+import net.minecraft.scoreboard.number.NumberFormat;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class)
@@ -21,36 +21,32 @@ public class InGameHudMixin {
at = @At("HEAD"),
cancellable = true
)
- public void onRenderStatusEffectOverlay(DrawContext context, CallbackInfo ci) {
+ public void onRenderStatusEffectOverlay(DrawContext context, float tickDelta, CallbackInfo ci) {
if (DulkirConfig.ConfigVars.getConfigOptions().getStatusEffectHidden()) {
ci.cancel();
}
}
- @Redirect(
- method = "method_55440([Lnet/minecraft/client/gui/hud/InGameHud$SidebarEntry;ILnet/minecraft/client/gui/DrawContext;Lnet/minecraft/text/Text;I)V",
+ @ModifyExpressionValue(
+ method = "renderScoreboardSidebar(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/scoreboard/ScoreboardObjective;)V",
at = @At(
value = "INVOKE",
- target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)I",
- ordinal = 2
+ target = "Lnet/minecraft/scoreboard/ScoreboardObjective;getNumberFormatOr(Lnet/minecraft/scoreboard/number/NumberFormat;)Lnet/minecraft/scoreboard/number/NumberFormat;"
)
)
- public int removeScoreBoardNumbers(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow) {
- return 0;
+ public NumberFormat removeScoreBoardNumbers(NumberFormat original) {
+ return BlankNumberFormat.INSTANCE;
}
- @ModifyExpressionValue(
- method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/entity/player/PlayerEntity;getArmor()I"
- )
+ @Inject(
+ method = "renderArmor",
+ at = @At("HEAD"),
+ cancellable = true
)
- public int onGrabArmorAmount(int original) {
+ private static void onGrabArmorAmount(DrawContext context, PlayerEntity player, int i, int j, int k, int x, CallbackInfo ci) {
if (DulkirConfig.ConfigVars.getConfigOptions().getHideArmorOverlay() && Utils.INSTANCE.isInSkyblock()) {
- return 0;
+ ci.cancel();
}
- return original;
}
@ModifyExpressionValue(