diff --git a/src/pmf/PMFLevel.php b/src/pmf/PMFLevel.php index 338467e0..760dce0c 100644 --- a/src/pmf/PMFLevel.php +++ b/src/pmf/PMFLevel.php @@ -100,7 +100,13 @@ class PMFLevel extends PMF{ $this->write(Utils::writeShort(0)); $X = $Z = null; $this->getXZ($index, $X, $Z); - @file_put_contents($this->getChunkPath($X, $Z), gzdeflate("", PMF_LEVEL_DEFLATE_LEVEL)); + + $chunk = @gzopen($this->getChunkPath($X, $Z), "wb" . PMF_LEVEL_DEFLATE_LEVEL); + gzwrite($chunk, chr(self::CHUNK_VERSION)); + gzwrite($chunk, Utils::writeShort(0)); //heightmap + gzwrite($chunk, "\x00"); //haslight + gzwrite($chunk, "\x00"); //ticking + gzclose($chunk); } if(!file_exists(dirname($this->file) . "/entities.yml")){ $entities = new Config(dirname($this->file) . "/entities.yml", CONFIG_YAML); @@ -183,6 +189,7 @@ class PMFLevel extends PMF{ $index = self::getIndex($X, $Z); $o = ord($this->hasLight[$index]); $this->hasLight[$index] = chr($o | 1); + $this->chunkChange[$index][-1] = true; return true; } public function markHasSkylight($X, $Z){ @@ -190,6 +197,7 @@ class PMFLevel extends PMF{ $index = self::getIndex($X, $Z); $o = ord($this->hasLight[$index]); $this->hasLight[$index] = chr($o | 2); + $this->chunkChange[$index][-1] = true; return true; } @@ -541,7 +549,7 @@ class PMFLevel extends PMF{ if($this->isChunkLoaded($X, $Z) === false){ $this->loadChunk($X, $Z); } - if(strlen($data) !== 8192){ + if(strlen($data) !== 10240){ return false; } $index = self::getIndex($X, $Z); diff --git a/src/world/generator/TemporalGenerator.php b/src/world/generator/TemporalGenerator.php index ae45ac04..d9b8badb 100644 --- a/src/world/generator/TemporalGenerator.php +++ b/src/world/generator/TemporalGenerator.php @@ -58,7 +58,8 @@ class TemporalGenerator implements LevelGenerator{ for($Y = 0; $Y < 8; ++$Y){ $chunk[$Y] .= substr($block, $Y << 4, 16); $chunk[$Y] .= substr($meta, $Y << 3, 8); - $chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00"; + $chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00"; //blocklight + $chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00"; //skylight } } }