make use of getSavableEntities() in Level->unloadChunk()

why couldn't I have thought of this before I changed this the first time >.>
This commit is contained in:
Dylan K. Taylor 2017-11-19 18:08:42 +00:00
parent a9df383346
commit 00a9ae6c95

View File

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