Require ext-chunkutils ^0.3.0

This commit is contained in:
Dylan K. Taylor
2021-09-07 22:53:50 +01:00
parent c605b54591
commit 11d2e1ef08
5 changed files with 26 additions and 8 deletions

View File

@ -446,8 +446,15 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
$layers = $subChunk->getBlockLayers();
$subStream->putByte(count($layers));
foreach($layers as $blocks){
$subStream->putByte($blocks->getBitsPerBlock() << 1);
$subStream->put($blocks->getWordArray());
if($blocks->getBitsPerBlock() !== 0){
$subStream->putByte($blocks->getBitsPerBlock() << 1);
$subStream->put($blocks->getWordArray());
}else{
//TODO: we use these in-memory, but they aren't supported on disk by the game yet
//polyfill them with a zero'd 1-bpb instead
$subStream->putByte(1 << 1);
$subStream->put(str_repeat("\x00", PalettedBlockArray::getExpectedWordArraySize(1)));
}
$palette = $blocks->getPalette();
$subStream->putLInt(count($palette));