Added proper chunk saving in McRegion

This commit is contained in:
Shoghi Cervantes 2014-07-29 19:36:41 +02:00
parent b0aad89e7a
commit 8fafb85784

View File

@ -191,15 +191,28 @@ class RegionLoader{
$nbt = $chunk->getNBT(); $nbt = $chunk->getNBT();
$nbt->Sections = new Enum("Sections", []); $nbt->Sections = new Enum("Sections", []);
$nbt->Sections->setTagType(NBT::TAG_Compound); $nbt->Sections->setTagType(NBT::TAG_Compound);
foreach($chunk->getSections() as $section){
$nbt->Sections[$section->getY()] = new Compound(null, [ $blocks = "";
"Y" => new Byte("Y", $section->getY()), $data = "";
"Blocks" => new ByteArray("Blocks", $section->getIdArray()), $skyLight = "";
"Data" => new ByteArray("Data", $section->getDataArray()), $blockLight = "";
"BlockLight" => new ByteArray("BlockLight", $section->getLightArray()), $sections = $chunk->getSections();
"SkyLight" => new ByteArray("SkyLight", $section->getSkyLightArray())
]); for($i = 0; $i < 256; ++$i){
$x = $i & 0x0F;
$z = $i >> 4;
for($s = 0; $s < 0; ++$s){
$blocks .= $sections[$s]->getBlockIdColumn($x, $z);
$data .= $sections[$s]->getBlockDataColumn($x, $z);
$skyLight .= $sections[$s]->getBlockSkyLightColumn($x, $z);
$blockLight .= $sections[$s]->getBlockLightColumn($x, $z);
} }
}
$nbt->Blocks = new ByteArray("Blocks", $blocks);
$nbt->Data = new ByteArray("Data", $data);
$nbt->SkyLight = new ByteArray("SkyLight", $skyLight);
$nbt->BlockLight = new ByteArray("BlockLight", $blockLight);
$nbt->Biomes = new ByteArray("Biomes", $chunk->getBiomeIdArray()); $nbt->Biomes = new ByteArray("Biomes", $chunk->getBiomeIdArray());
$nbt->BiomeColors = new IntArray("BiomeColors", $chunk->getBiomeColorArray()); $nbt->BiomeColors = new IntArray("BiomeColors", $chunk->getBiomeColorArray());