From 00a9ae6c953089bd6b2a7aeae0c444f05957ebe9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 19 Nov 2017 18:08:42 +0000 Subject: [PATCH] make use of getSavableEntities() in Level->unloadChunk() why couldn't I have thought of this before I changed this the first time >.> --- src/pocketmine/level/Level.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 49daa8c70..b6b377a30 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2641,15 +2641,7 @@ class Level implements ChunkManager, Metadatable{ try{ if($chunk !== null){ if($trySave and $this->getAutoSave() and $chunk->isGenerated()){ - $entities = 0; - foreach($chunk->getEntities() as $e){ - if(!$e->canSaveWithChunk()){ - continue; - } - ++$entities; - } - - if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or $entities > 0){ + if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or count($chunk->getSavableEntities()) > 0){ $this->provider->setChunk($x, $z, $chunk); $this->provider->saveChunk($x, $z); }