Skip to content

Commit 9d529ae

Browse files
committed
Make sure at block center for findSafeSpot
1 parent 0720ca4 commit 9d529ae

File tree

1 file changed

+3
-2
lines changed
  • bukkit/src/main/kotlin/io/github/rothes/esu/bukkit/util

1 file changed

+3
-2
lines changed

bukkit/src/main/kotlin/io/github/rothes/esu/bukkit/util/WorldUtils.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import kotlinx.coroutines.CompletableDeferred
66
import kotlinx.coroutines.withTimeout
77
import org.bukkit.Location
88
import org.bukkit.World
9+
import kotlin.math.floor
910
import kotlin.time.Duration.Companion.seconds
1011

1112
object WorldUtils {
1213

1314
suspend fun findSafeSpot(column: Location): Location? {
1415
val deferred = CompletableDeferred<Location?>()
1516
val location = column.clone()
16-
location.x += 0.5
17-
location.z += 0.5
17+
location.x += floor(location.x) + 0.5
18+
location.z += floor(location.z) + 0.5
1819
Scheduler.schedule(location) {
1920
val world = requireNotNull(location.world) { "Location world is null" }
2021
val y = if (world.environment == World.Environment.NETHER) {

0 commit comments

Comments
 (0)