mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
More tweaks
This commit is contained in:
@ -105,4 +105,12 @@ class EmptySubChunk extends SubChunk{
|
|||||||
public function getSkyLightArray() : string{
|
public function getSkyLightArray() : string{
|
||||||
return str_repeat("\xff", 2048);
|
return str_repeat("\xff", 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function networkSerialize() : string{
|
||||||
|
return "\x00" . str_repeat("\x00", 10240);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fastSerialize() : string{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
@ -621,12 +621,7 @@ class GenericChunk implements Chunk{
|
|||||||
$subChunkCount = $this->getSubChunkSendCount();
|
$subChunkCount = $this->getSubChunkSendCount();
|
||||||
$result .= chr($subChunkCount);
|
$result .= chr($subChunkCount);
|
||||||
for($y = 0; $y < $subChunkCount; ++$y){
|
for($y = 0; $y < $subChunkCount; ++$y){
|
||||||
$subChunk = $this->subChunks[$y];
|
$result .= $this->subChunks[$y]->networkSerialize();
|
||||||
$result .= "\x00" //unknown byte!
|
|
||||||
. $subChunk->getBlockIdArray()
|
|
||||||
. $subChunk->getBlockDataArray()
|
|
||||||
. str_repeat("\x00", 2048) //$subChunk->getSkyLightArray()
|
|
||||||
. $subChunk->getBlockLightArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: heightmaps, tile data
|
//TODO: heightmaps, tile data
|
||||||
@ -644,11 +639,7 @@ class GenericChunk implements Chunk{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
++$count;
|
++$count;
|
||||||
$subChunks .= chr($subChunk->getY())
|
$subChunks .= $subChunk->fastSerialize();
|
||||||
. $subChunk->getBlockIdArray()
|
|
||||||
. $subChunk->getBlockDataArray()
|
|
||||||
. $subChunk->getSkyLightArray()
|
|
||||||
. $subChunk->getBlockLightArray();
|
|
||||||
}
|
}
|
||||||
$stream->putByte($count);
|
$stream->putByte($count);
|
||||||
$stream->put($subChunks);
|
$stream->put($subChunks);
|
||||||
@ -677,7 +668,7 @@ class GenericChunk implements Chunk{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$heightMap = array_values(unpack("C*", $stream->get(256)));
|
$heightMap = array_values(unpack("C*", $stream->get(256)));
|
||||||
$biomeColors = array_values(unpack("N*", $stream->get(1024)));
|
$biomeColors = array_values(unpack("N*", $stream->get(1024))); //TODO: remove this
|
||||||
|
|
||||||
$chunk = new GenericChunk($provider, $x, $z, $subChunks, $heightMap, $biomeColors);
|
$chunk = new GenericChunk($provider, $x, $z, $subChunks, $heightMap, $biomeColors);
|
||||||
$flags = $stream->getByte();
|
$flags = $stream->getByte();
|
||||||
|
@ -202,4 +202,14 @@ class SubChunk{
|
|||||||
assert(strlen($this->skyLight) === 2048, "Wrong length of skylight array, expecting 2048 bytes, got " . strlen($this->skyLight));
|
assert(strlen($this->skyLight) === 2048, "Wrong length of skylight array, expecting 2048 bytes, got " . strlen($this->skyLight));
|
||||||
return $this->skyLight;
|
return $this->skyLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function networkSerialize() : string{
|
||||||
|
// storage version, ids, data, skylight, blocklight
|
||||||
|
return "\x00" . $this->ids . $this->data . $this->skyLight . $this->blockLight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fastSerialize() : string{
|
||||||
|
// y, ids, data, skylight, blocklight
|
||||||
|
return chr($this->y) . $this->ids . $this->data . $this->skyLight . $this->blockLight;
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user