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()); }