From 6f7b487648e7f51534cfaf71fdcb2fe77cbbb140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?der=5Ffr=C3=BChling?= Date: Thu, 8 Aug 2024 21:35:51 -0700 Subject: [PATCH] yeouch --- .../minecraft/create/trainperspective/Perspective.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java index 516c454..8cd8255 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java @@ -87,6 +87,15 @@ default float getYaw(float f) { var ref = getReference(); if (ref == null) return 0.0f; if (f == 1.0f) return ref.yaw * getValueScale(); + + while (ref.yaw - ref.prevYaw < -180.0f) { + ref.prevYaw -= 360.0f; + } + + while (ref.yaw - ref.prevYaw >= 180.0f) { + ref.prevYaw += 360.0f; + } + return Mth.lerp(f, ref.prevYaw * getPrevValueScale(), ref.yaw * getValueScale()); }