diff --git a/src/pocketmine/level/format/generic/EmptySubChunk.php b/src/pocketmine/level/format/generic/EmptySubChunk.php index 68efce318..e810b8771 100644 --- a/src/pocketmine/level/format/generic/EmptySubChunk.php +++ b/src/pocketmine/level/format/generic/EmptySubChunk.php @@ -108,10 +108,10 @@ class EmptySubChunk extends SubChunk{ } public function networkSerialize() : string{ - return str_repeat("\x00", 10240); + return "\x00" . str_repeat("\x00", 10240); } public function fastSerialize() : string{ - return ""; + throw new \BadMethodCallException("Should not try to serialize empty subchunks"); } } \ No newline at end of file diff --git a/src/pocketmine/level/format/generic/GenericChunk.php b/src/pocketmine/level/format/generic/GenericChunk.php index 6f7c94d8c..5ad0583f7 100644 --- a/src/pocketmine/level/format/generic/GenericChunk.php +++ b/src/pocketmine/level/format/generic/GenericChunk.php @@ -628,7 +628,7 @@ class GenericChunk implements Chunk{ $count = 0; $subChunks = ""; foreach($chunk->subChunks as $y => $subChunk){ - if($subChunk->isEmpty()){ + if($subChunk instanceof EmptySubChunk){ continue; } ++$count;