Fixed NBT compression, Anvil generated worlds are readable by Minecraft and other tools

This commit is contained in:
Shoghi Cervantes 2014-06-17 19:32:09 +02:00
parent f073a5b837
commit 85007a9dfe
2 changed files with 2 additions and 2 deletions

View File

@ -160,7 +160,7 @@ class RegionLoader{
$writer = new NBT(NBT::BIG_ENDIAN);
$nbt->setName("Level");
$writer->setData(new Compound("", array("Level" => $nbt)));
$chunkData = $writer->writeCompressed(self::COMPRESSION_ZLIB, self::$COMPRESSION_LEVEL);
$chunkData = $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, self::$COMPRESSION_LEVEL);
$length = strlen($chunkData) + 1;
$sectors = (int) ceil(($length + 4) / 4096);
$index = self::getChunkOffset($x, $z);

View File

@ -121,7 +121,7 @@ class NBT{
public function writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){
if(($write = $this->write()) !== false){
return zlib_encode($write, ZLIB_ENCODING_GZIP, $level);
return zlib_encode($write, $compression, $level);
}
return false;