diff options
author | Linnea Gräf <nea@nea.moe> | 2024-05-09 22:12:27 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-05-09 22:12:27 +0200 |
commit | dce5a156849a3ba1b09e28dbfc153fc14a7f7b2c (patch) | |
tree | b51bffce829a14ed1bdccb581acec2dd1838540e /src/main/java/com/dulkirfabric/mixin | |
parent | 9d2b7bec68f98228acf913f029f0383e4dcff3d7 (diff) | |
download | DulkirMod-Fabric-master.tar.gz DulkirMod-Fabric-master.tar.bz2 DulkirMod-Fabric-master.zip |
Diffstat (limited to 'src/main/java/com/dulkirfabric/mixin')
5 files changed, 18 insertions, 57 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java b/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java index 7820bf3..f083290 100644 --- a/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java @@ -1,7 +1,7 @@ package com.dulkirfabric.mixin; import com.dulkirfabric.util.render.ItemChangeHandler; -import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.item.TooltipType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -20,7 +20,7 @@ public abstract class ItemStackMixin { @Shadow public abstract Item getItem(); @Inject(method = "getTooltip", at = @At("HEAD")) - private void onGetTooltip(@Nullable PlayerEntity player, TooltipContext context, CallbackInfoReturnable<List<Text>> cir) { + private void onGetTooltip(Item.TooltipContext context, @Nullable PlayerEntity player, TooltipType type, CallbackInfoReturnable<List<Text>> cir) { ItemChangeHandler.INSTANCE.handle(this.getItem().getName().getString()); } } diff --git a/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java b/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java index 76dd828..d805170 100644 --- a/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java @@ -19,16 +19,6 @@ public class MouseMixin { return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale()); } - @ModifyExpressionValue(method = "onCursorPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I")) - public int onCursorPosWidth(int originalScaledWidth) { - return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale()); - } - - @ModifyExpressionValue(method = "onCursorPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledHeight()I")) - public int onCursorPosHeight(int originalScaledHeight) { - return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale()); - } - @ModifyExpressionValue(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I")) public int onMouseScrollWidth(int originalScaledWidth) { return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale()); 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( diff --git a/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java deleted file mode 100644 index 0270251..0000000 --- a/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.dulkirfabric.mixin.render; - -import com.dulkirfabric.features.InventoryScale; -import net.minecraft.block.entity.BannerPattern; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.LoomScreen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtList; -import net.minecraft.registry.entry.RegistryEntry; -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.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -@Mixin(LoomScreen.class) -public class LoomScreenMixin { - @Inject(method = "drawBanner", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) - public void onCreateMatrix(DrawContext context, RegistryEntry<BannerPattern> pattern, int x, int y, CallbackInfo ci, NbtCompound nbtCompound, NbtList nbtList, ItemStack itemStack, MatrixStack matrixStack) { - matrixStack.scale(InventoryScale.INSTANCE.getScale(), InventoryScale.INSTANCE.getScale(), 1F); - } -} - diff --git a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java index 58558e0..676cccf 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; @Mixin(WorldRenderer.class) public class WorldRendererMixin { - @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lorg/joml/Matrix4f;)V", + @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getTeamColorValue()I")) public int getGlowColor(int existing, @Local Entity entity) { if (entity instanceof GlowingEntityInterface dEntity) { |