region: harden handling of ByteArrayTag

previously this would just explode if the wrong length of data was given.
This commit is contained in:
Dylan K. Taylor
2020-10-31 15:37:06 +00:00
parent 058bb3a91a
commit 0cbc5c9a4a
4 changed files with 24 additions and 5 deletions

View File

@ -36,7 +36,10 @@ class Anvil extends RegionWorldProvider{
}
protected function deserializeSubChunk(CompoundTag $subChunk) : SubChunk{
return new SubChunk(BlockLegacyIds::AIR << 4, [SubChunkConverter::convertSubChunkYZX($subChunk->getByteArray("Blocks"), $subChunk->getByteArray("Data"))]);
return new SubChunk(BlockLegacyIds::AIR << 4, [SubChunkConverter::convertSubChunkYZX(
self::readFixedSizeByteArray($subChunk, "Blocks", 4096),
self::readFixedSizeByteArray($subChunk, "Data", 2048)
)]);
//ignore legacy light information
}