diff --git a/server/src/main/java/org/allaymc/server/entity/component/EntityBaseComponentImpl.java b/server/src/main/java/org/allaymc/server/entity/component/EntityBaseComponentImpl.java index 66f38f723..2f3dd1014 100644 --- a/server/src/main/java/org/allaymc/server/entity/component/EntityBaseComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/entity/component/EntityBaseComponentImpl.java @@ -339,7 +339,7 @@ protected boolean checkChunk(Location3fc oldLoc, Location3fc newLoc) { if (newChunk == null) { // Moving into an unloaded chunk is not allowed. Because the chunk holds the entity, // moving to an unloaded chunk will result in the loss of the entity - log.warn("New chunk {} {} is null while moving entity!", newChunkX, newChunkZ); + log.warn("Entity {} is trying to move into unloaded chunk {} {}", runtimeId, newChunkX, newChunkZ); return false; } diff --git a/server/src/main/java/org/allaymc/server/world/service/AllayEntityPhysicsService.java b/server/src/main/java/org/allaymc/server/world/service/AllayEntityPhysicsService.java index f3117080f..440ebbb9d 100644 --- a/server/src/main/java/org/allaymc/server/world/service/AllayEntityPhysicsService.java +++ b/server/src/main/java/org/allaymc/server/world/service/AllayEntityPhysicsService.java @@ -501,6 +501,9 @@ protected boolean updateEntityLocation(Entity entity, Location3fc newLoc) { baseComponent.broadcastMoveToViewers(newLoc, false); return true; } else { + // Entity is moving into unloaded chunk, and we need to reset the motion + // to prevent the entity from moving into unloaded chunk continuously + entity.setMotion(0, 0, 0); return false; } }