From 3c892182fd31f75bd263973bbe7e41079d7b2908 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 29 Oct 2020 12:57:33 +0000 Subject: [PATCH] World: change some usages of getOrLoadChunk() to getChunk() these usages don't require getOrLoadChunk() because they already check for unloaded chunks anyway. --- src/world/World.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index f059f589b1..4681372024 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1697,7 +1697,7 @@ class World implements ChunkManager{ if(!$this->isChunkLoaded($x, $z)){ continue; } - foreach($this->getOrLoadChunk($x, $z)->getEntities() as $ent){ + foreach($this->getChunk($x, $z)->getEntities() as $ent){ /** @var Entity|null $entity */ if($ent->canBeCollidedWith() and ($entity === null or ($ent !== $entity and $entity->canCollideWith($ent))) and $ent->boundingBox->intersectsWith($bb)){ $nearby[] = $ent; @@ -1728,7 +1728,7 @@ class World implements ChunkManager{ if(!$this->isChunkLoaded($x, $z)){ continue; } - foreach($this->getOrLoadChunk($x, $z)->getEntities() as $ent){ + foreach($this->getChunk($x, $z)->getEntities() as $ent){ if($ent !== $entity and $ent->boundingBox->intersectsWith($bb)){ $nearby[] = $ent; } @@ -1771,7 +1771,7 @@ class World implements ChunkManager{ if(!$this->isChunkLoaded($x, $z)){ continue; } - foreach($this->getOrLoadChunk($x, $z)->getEntities() as $entity){ + foreach($this->getChunk($x, $z)->getEntities() as $entity){ if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){ continue; }