physics: fix movement into unloaded chunks

This commit is contained in:
Bixilon 2021-04-27 17:21:37 +02:00
parent cd0885a56c
commit 7be7124013
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -213,7 +213,7 @@ abstract class Entity(
val result = VoxelShape() val result = VoxelShape()
for (blockPosition in blockPositions) { for (blockPosition in blockPositions) {
val chunk = connection.world.getChunk(blockPosition.chunkPosition) val chunk = connection.world.getChunk(blockPosition.chunkPosition)
if (chunk == null && !ignoreUnloadedChunks) { if ((chunk == null || !chunk.isFullyLoaded) && !ignoreUnloadedChunks) {
// chunk is not loaded // chunk is not loaded
result.add(VoxelShape.FULL + blockPosition) result.add(VoxelShape.FULL + blockPosition)
continue continue
@ -284,7 +284,7 @@ abstract class Entity(
} }
} }
velocity?.let { velocity?.let {
move(it * deltaTime) move(it * deltaTime, false)
} }
} }