diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt b/src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt index 5a7911c..7a20346 100644 --- a/src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt +++ b/src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt @@ -30,9 +30,9 @@ object WarpUtil { private var lastAttemptedWarp = "" private var lastWarpAttempt = TimeMark.farPast() - fun findNearestWarp(locrawMode: String, pos: Position): Islands.Warp? { + fun findNearestWarp(island: SkyBlockIsland, pos: Position): Islands.Warp? { return warps.minByOrNull { - if (locrawMode != it.mode || (DConfig.data?.excludedWarps?.contains(it.warp) == true)) { + if (island.locrawMode != it.mode || (DConfig.data?.excludedWarps?.contains(it.warp) == true)) { return@minByOrNull Double.MAX_VALUE } else { return@minByOrNull squaredDist(pos, it) @@ -47,10 +47,10 @@ object WarpUtil { return dx * dx + dy * dy + dz * dz } - fun teleportToNearestWarp(locrawMode: String, pos: Position) { - val nearestWarp = findNearestWarp(locrawMode, pos) ?: return + fun teleportToNearestWarp(island: SkyBlockIsland, pos: Position) { + val nearestWarp = findNearestWarp(island, pos) ?: return - if (locrawMode == SBData.skyblockLocation + if (island == SBData.skyblockLocation && sqrt(squaredDist(pos, nearestWarp)) > 1.1 * sqrt(squaredDist((MC.player ?: return).pos, nearestWarp)) ) { return |