From ca383998f3e0e207da66af5ac5b337577d2a4a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?der=5Ffr=C3=BChling?= Date: Sun, 12 May 2024 13:03:59 -0700 Subject: [PATCH] #24 greatly improve camera movement in third-person MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit still not perfect, but much better Signed-off-by: der_frühling --- .../minecraft/create/trainperspective/mixin/CameraMixin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java index 5f8b735..0143203 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java @@ -1,5 +1,6 @@ package net.derfruhling.minecraft.create.trainperspective.mixin; +import com.llamalad7.mixinextras.sugar.Local; import net.derfruhling.minecraft.create.trainperspective.Camera3D; import net.derfruhling.minecraft.create.trainperspective.Perspective; import net.minecraft.client.Camera; @@ -31,8 +32,8 @@ private float modifyRoll(float original) { } @Redirect(method = "setup", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;setRotation(FF)V")) - public void modifyRotationsPrimary(Camera instance, float y, float x) { - if(entity instanceof LocalPlayer player) { + public void modifyRotationsPrimary(Camera instance, float y, float x, @Local(argsOnly = true, ordinal = 1) boolean isThirdPerson) { + if(entity instanceof LocalPlayer player && !isThirdPerson) { var persp = (Perspective) Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(player); ctp$zRot = persp.getLean() * Mth.cos((persp.getYaw() - y) * Mth.DEG_TO_RAD); setRotation(y, x - persp.getLean() * Mth.sin((persp.getYaw() - y) * Mth.DEG_TO_RAD));