summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt2
2 files changed, 3 insertions, 1 deletions
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)