From 579e110cd69703529cbc0fe4416dec14b7084066 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Thu, 19 May 2022 22:18:44 -0500 Subject: [PATCH] close 75 --- .../petrak/hexcasting/fabric/FabricHexClientInitializer.kt | 7 +++++++ .../fabric/mixin/client/FabricMouseHandlerMixin.java | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt index cacbcbd2..27f9c0f1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -20,7 +20,14 @@ object FabricHexClientInitializer : ClientModInitializer { FabricPacketHandler.initClient() WorldRenderEvents.LAST.register { ctx -> + // https://www.3dgep.com/understanding-quaternions/ + val quat = ctx.camera().rotation().copy() + quat.mul(-1f) // this should invert it? + ctx.matrixStack().pushPose() + ctx.matrixStack().mulPose(quat) + ctx.matrixStack().scale(-1f, 1f, -1f) HexAdditionalRenderers.overlayLevel(ctx.matrixStack(), ctx.tickDelta()) + ctx.matrixStack().popPose() } HudRenderCallback.EVENT.register(HexAdditionalRenderers::overlayGui) WorldRenderEvents.START.register { ClientTickCounter.renderTickStart(it.tickDelta()) } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/client/FabricMouseHandlerMixin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/client/FabricMouseHandlerMixin.java index 8a31106a..66e7bf3f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/client/FabricMouseHandlerMixin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/client/FabricMouseHandlerMixin.java @@ -10,8 +10,8 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(MouseHandler.class) public class FabricMouseHandlerMixin { - @Inject(method = "onScroll", cancellable = true, locals = LocalCapture.PRINT, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) - private void onScroll(CallbackInfo ci, double delta) { + @Inject(method = "onScroll", cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) + private void onScroll(long winptr, double xOff, double yOff, CallbackInfo ci, double delta) { var cancel = MouseScrollCallback.EVENT.invoker().interact(delta); if (cancel) { ci.cancel();