aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
index 2fb009914..e2fc562f3 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
@@ -36,7 +36,7 @@ class ParkourWaypointSaver {
update()
}
if (config.saveKey == key) {
- val newLocation = LocationUtils.playerLocation().roundLocation()
+ val newLocation = LorenzVec.getBlockBelowPlayer()
if (locations.isNotEmpty()) {
if (newLocation == locations.last()) return
}
@@ -69,7 +69,7 @@ class ParkourWaypointSaver {
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (locations.size > 2) {
+ if (locations.size > 1) {
parkourHelper?.render(event)
} else {
for (location in locations) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
index 46f273b2d..5f719da63 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
@@ -96,6 +96,13 @@ data class LorenzVec(
fun round(decimals: Int) = LorenzVec(x.round(decimals), y.round(decimals), z.round(decimals))
+ fun roundLocationToBlock(): LorenzVec {
+ val x = (x - .499999).round(0)
+ val y = (y - .499999).round(0)
+ val z = (z - .499999).round(0)
+ return LorenzVec(x, y, z)
+ }
+
fun slope(other: LorenzVec, factor: Double) = add(other.subtract(this).scale(factor))
fun roundLocation(): LorenzVec {
@@ -127,6 +134,8 @@ data class LorenzVec(
val (x, y, z) = string.split(":").map { it.toDouble() }
return LorenzVec(x, y, z)
}
+
+ fun getBlockBelowPlayer() = LocationUtils.playerLocation().roundLocationToBlock().add(0.0, -1.0, 0.0)
}
}