From 0344ab23929f77f4f339cb0dc83d84d3f118d679 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:48:34 +0200 Subject: Added Living Metal Helper --- src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 2 ++ src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index 7380c4c37..46f273b2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -96,6 +96,8 @@ data class LorenzVec( fun round(decimals: Int) = LorenzVec(x.round(decimals), y.round(decimals), z.round(decimals)) + fun slope(other: LorenzVec, factor: Double) = add(other.subtract(this).scale(factor)) + fun roundLocation(): LorenzVec { val x = if (this.x < 0) x.toInt().toDouble() - 1 else x.toInt().toDouble() val y = y.toInt().toDouble() - 1 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 73a529cbc..410c29aca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -141,7 +141,7 @@ class ParkourHelper( if (LocationUtils.playerLocation().distance(nextPosition) > currentPosition.distance(nextPosition)) return null val factor = LocationUtils.playerLocation().distance(currentPosition) / currentPosition.distance(nextPosition) - val solpeLocation = lookAheadStart.add(lookAheadEnd.subtract(lookAheadStart).scale(factor)) + val solpeLocation = lookAheadStart.slope(lookAheadEnd, factor) return Pair( IndexedValue(current + lookAhead - 1, lookAheadStart), IndexedValue(current + lookAhead, solpeLocation) -- cgit