From a4042e5d1828336b147b34ae6e330ddd8c7ddb39 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 29 Jul 2019 18:07:17 +0100 Subject: [PATCH] World: fix more implicit chunk loading bugs (getCollidingEntities(), getNearbyEntities(), getNearestEntity()) --- src/pocketmine/world/World.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pocketmine/world/World.php b/src/pocketmine/world/World.php index 50a0be869..97aa5132b 100644 --- a/src/pocketmine/world/World.php +++ b/src/pocketmine/world/World.php @@ -1826,6 +1826,9 @@ class World implements ChunkManager{ for($x = $minX; $x <= $maxX; ++$x){ for($z = $minZ; $z <= $maxZ; ++$z){ + if(!$this->isChunkLoaded($x, $z)){ + continue; + } foreach($this->getChunkEntities($x, $z) as $ent){ /** @var Entity|null $entity */ if($ent->canBeCollidedWith() and ($entity === null or ($ent !== $entity and $entity->canCollideWith($ent))) and $ent->boundingBox->intersectsWith($bb)){ @@ -1857,6 +1860,9 @@ class World implements ChunkManager{ for($x = $minX; $x <= $maxX; ++$x){ for($z = $minZ; $z <= $maxZ; ++$z){ + if(!$this->isChunkLoaded($x, $z)){ + continue; + } foreach($this->getChunkEntities($x, $z) as $ent){ if($ent !== $entity and $ent->boundingBox->intersectsWith($bb)){ $nearby[] = $ent; @@ -1893,6 +1899,9 @@ class World implements ChunkManager{ for($x = $minX; $x <= $maxX; ++$x){ for($z = $minZ; $z <= $maxZ; ++$z){ + if(!$this->isChunkLoaded($x, $z)){ + continue; + } foreach($this->getChunkEntities($x, $z) as $entity){ if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){ continue;