diff options
author | Linnea Gräf <nea@nea.moe> | 2024-08-04 21:10:08 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-08-04 21:10:08 +0200 |
commit | 9b277bd897490d13ee4549a086e8d1b5f4cd0e10 (patch) | |
tree | 8f966a8f5b981cb700becb337e43970eb0619fcc /src/main/kotlin/moe/nea/firmament/util/WarpUtil.kt | |
parent | 95c1b75a14d41b070c4e23addb3ac4788a014365 (diff) | |
download | Firmament-9b277bd897490d13ee4549a086e8d1b5f4cd0e10.tar.gz Firmament-9b277bd897490d13ee4549a086e8d1b5f4cd0e10.tar.bz2 Firmament-9b277bd897490d13ee4549a086e8d1b5f4cd0e10.zip |
Add SkyBlockIsland type
[no changelog]
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 |