From 9eb2a46942c806ed1115517e5056653781595a68 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 1 Nov 2023 15:53:37 +0000 Subject: [PATCH] World: remove useless isChunkLoaded checks getChunkEntities() will return an empty array if the chunk isn't loaded anyway, so this is just wasting CPU cycles. --- src/world/World.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index 1ecbe20a9..4ff930dd1 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -2292,9 +2292,6 @@ 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 && $ent->boundingBox->intersectsWith($bb)){ $nearby[] = $ent; @@ -2335,9 +2332,6 @@ 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) || $entity->isFlaggedForDespawn() || (!$includeDead && !$entity->isAlive())){ continue;