From b09648d71258f8d4012c9b50d679f7c3db9201b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Sun, 6 Jul 2025 23:34:56 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20incorrect=20macro=20wheel=20for=20two=20?= =?UTF-8?q?items=20because=20of=20angle=20lerp=20near=20=CF=80=20/=202=20d?= =?UTF-8?q?efaulting=20the=20wrong=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 2 +- src/main/kotlin/util/render/LerpUtils.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5ec658..d4ff2c4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -73,7 +73,7 @@ jarvis = "1.1.4" nealisp = "1.1.0" # Update from https://github.com/NotEnoughUpdates/MoulConfig/tags -moulconfig = "4.0.0-beta" +moulconfig = "4.0.1-beta" # Update from https://repo.nea.moe/#/releases/moe/nea/mc-auto-translations/moe.nea.mc-auto-translations.gradle.plugin mcAutoTranslations = "0.3.0" diff --git a/src/main/kotlin/util/render/LerpUtils.kt b/src/main/kotlin/util/render/LerpUtils.kt index 63a13ec..e7f226c 100644 --- a/src/main/kotlin/util/render/LerpUtils.kt +++ b/src/main/kotlin/util/render/LerpUtils.kt @@ -1,11 +1,15 @@ package moe.nea.firmament.util.render import me.shedaniel.math.Color +import kotlin.math.absoluteValue val π = Math.PI val τ = Math.PI * 2 -fun lerpAngle(a: Float, b: Float, progress: Float): Float { +fun lerpAngle(a: Float, b: Float, progress: Float): Float { // TODO: there is at least 10 mods to many in here lol + if (((b - a).absoluteValue - π).absoluteValue < 0.0001) { + return lerp(a, b, progress) + } val shortestAngle = ((((b.mod(τ) - a.mod(τ)).mod(τ)) + τ + π).mod(τ)) - π return ((a + (shortestAngle) * progress).mod(τ)).toFloat() }