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.
This commit is contained in:
Dylan K. Taylor 2023-11-01 15:53:37 +00:00
parent b41960dfec
commit 9eb2a46942
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -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;