[Network]ChunkSerializer: allow injecting RuntimeBlockMapping

this will allow the same serializer to be reused with different mapping tables (will be needed for multi version).
This commit is contained in:
Dylan K. Taylor
2020-05-04 12:14:27 +01:00
parent 53a33e8c20
commit c2857a91bd
2 changed files with 3 additions and 3 deletions

View File

@ -51,10 +51,9 @@ final class ChunkSerializer{
return 0;
}
public static function serialize(Chunk $chunk, ?string $tiles = null) : string{
public static function serialize(Chunk $chunk, RuntimeBlockMapping $blockMapper, ?string $tiles = null) : string{
$stream = new NetworkBinaryStream();
$subChunkCount = self::getSubChunkCount($chunk);
$blockMapper = RuntimeBlockMapping::getInstance();
for($y = 0; $y < $subChunkCount; ++$y){
$layers = $chunk->getSubChunk($y)->getBlockLayers();
$stream->putByte(8); //version