From c364867465550a8a5b0a40c791fbac3a566ed373 Mon Sep 17 00:00:00 2001 From: yurisuika Date: Wed, 10 Jan 2024 09:37:09 -0800 Subject: [PATCH] 1.20.5 snapshot support --- gradle.properties | 6 +- .../mixin/client/gui/hud/InGameHudMixin.java | 149 ++++-------------- src/main/resources/fabric.mod.json | 4 +- 3 files changed, 32 insertions(+), 127 deletions(-) diff --git a/gradle.properties b/gradle.properties index e1e571df..683d1a01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs = -Xmx3G loom.platform = fabric -minecraft_version = 1.20.4 -yarn_mappings = 1.20.4+build.3 +minecraft_version = 23w51b +yarn_mappings = 23w51b+build.4 loader_version = 0.15.3 mod_id = raised @@ -11,4 +11,4 @@ mod_version = 3.1.1 maven_group = dev.yurisuika.raised archives_base_name = raised -fabric_version = 0.92.1+1.20.4 \ No newline at end of file +fabric_version = 0.92.1+1.20.5 \ No newline at end of file diff --git a/src/main/java/dev/yurisuika/raised/mixin/client/gui/hud/InGameHudMixin.java b/src/main/java/dev/yurisuika/raised/mixin/client/gui/hud/InGameHudMixin.java index 0be4ac27..8f80c461 100644 --- a/src/main/java/dev/yurisuika/raised/mixin/client/gui/hud/InGameHudMixin.java +++ b/src/main/java/dev/yurisuika/raised/mixin/client/gui/hud/InGameHudMixin.java @@ -17,132 +17,35 @@ public abstract class InGameHudMixin { @Mixin(value = InGameHud.class, priority = -999999999) public abstract static class Pre { - // HEAD - @Inject(method = "render", at = @At("HEAD")) - private void startHeadTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - if (getSupport()) { - context.getMatrices().translate(0, -getHud(), 0); - } - } - - // SPECTATOR MENU - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;renderSpectatorMenu(Lnet/minecraft/client/gui/DrawContext;)V")) + // MAIN HUD + @Inject(method = "renderMainHud", at = @At(value = "HEAD")) private void startSpectatorMenuTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { context.getMatrices().translate(0, -getHud(), 0); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;renderSpectatorMenu(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endSpectatorMenuTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // HOTBAR - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbar(FLnet/minecraft/client/gui/DrawContext;)V")) - private void startHotbarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbar(FLnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endHotbarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // STATUS BARS - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V")) - private void startStatusBarsTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endStatusBarsTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // MOUNT HEALTH BAR - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderMountHealth(Lnet/minecraft/client/gui/DrawContext;)V")) - private void startMountHealthTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderMountHealth(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endMountHealthTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // MOUNT JUMP BAR - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderMountJumpBar(Lnet/minecraft/entity/JumpingMount;Lnet/minecraft/client/gui/DrawContext;I)V")) - private void startMountJumpBarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderMountJumpBar(Lnet/minecraft/entity/JumpingMount;Lnet/minecraft/client/gui/DrawContext;I)V", shift = At.Shift.AFTER)) - private void endMountJumpBarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // EXPERIENCE BAR - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderExperienceBar(Lnet/minecraft/client/gui/DrawContext;I)V")) - private void startExperienceBarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderExperienceBar(Lnet/minecraft/client/gui/DrawContext;I)V", shift = At.Shift.AFTER)) - private void endExperienceBarTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - - // HELD ITEM TOOLTIP - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHeldItemTooltip(Lnet/minecraft/client/gui/DrawContext;)V")) - private void startHeldItemTooltipTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHeldItemTooltip(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endHeldItemTooltipTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - // SPECTATOR TOOLTIP - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;render(Lnet/minecraft/client/gui/DrawContext;)V")) - private void startSpectatorHudTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, -getHud(), 0); - } - - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;render(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) - private void endSpectatorHudTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } +// @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;render(Lnet/minecraft/client/gui/DrawContext;)V")) +// private void startSpectatorHudTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { +// context.getMatrices().translate(0, -getHud(), 0); +// } +// +// @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;render(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.AFTER)) +// private void endSpectatorHudTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { +// context.getMatrices().translate(0, +getHud(), 0); +// } // OVERLAY MESSAGE - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V", ordinal = 0)) + @Inject(method = "renderOverlayMessage", at = @At(value = "HEAD")) private void startOverlayMessageTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { context.getMatrices().translate(0, -getHud(), 0); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;pop()V", ordinal = 0, shift = At.Shift.AFTER)) - private void endOverlayMessageTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +getHud(), 0); - } - // CHAT - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/gui/DrawContext;III)V")) + @Inject(method = "renderChat", at = @At(value = "HEAD")) private void startChatTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { context.getMatrices().translate(0, -(getSync() ? getHud() : getChat()), +300); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/gui/DrawContext;III)V", shift = At.Shift.AFTER)) - private void endChatTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - context.getMatrices().translate(0, +(getSync() ? getHud() : getChat()), -300); - } - - // TAIL - @Inject(method = "render", at = @At("TAIL")) - private void startTailTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - if (getSupport()) { - context.getMatrices().translate(0, -getHud(), 0); - } - } - // HOTBAR SELECTOR @ModifyArgs(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 1)) private void resizeHotbarSelector(Args args) { @@ -155,20 +58,22 @@ private void resizeHotbarSelector(Args args) { @Mixin(value = InGameHud.class, priority = 999999999) public abstract static class Post { - // HEAD - @Inject(method = "render", at = @At("HEAD")) - private void endHeadTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - if (getSupport()) { - context.getMatrices().translate(0, +getHud(), 0); - } + // MAIN HUD + @Inject(method = "renderMainHud", at = @At(value = "TAIL")) + private void endSpectatorMenuTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { + context.getMatrices().translate(0, +getHud(), 0); + } + + // OVERLAY MESSAGE + @Inject(method = "renderOverlayMessage", at = @At(value = "TAIL")) + private void endOverlayMessageTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { + context.getMatrices().translate(0, +getHud(), 0); } - // TAIL - @Inject(method = "render", at = @At("TAIL")) - private void endTailTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { - if (getSupport()) { - context.getMatrices().translate(0, +getHud(), 0); - } + // CHAT + @Inject(method = "renderChat", at = @At(value = "TAIL")) + private void endChatTranslate(DrawContext context, float tickDelta, CallbackInfo ci) { + context.getMatrices().translate(0, +(getSync() ? getHud() : getChat()), -300); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3b0cc9c6..048eadac 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,8 +32,8 @@ "accessWidener" : "raised.accesswidener", "depends": { - "fabricloader": ">=0.14.21", - "minecraft": ">=1.20.2 <=1.20.4", + "fabricloader": ">=0.15.3", + "minecraft": ">=1.20.4", "java": ">=17" } } \ No newline at end of file