mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Use Chunk::getSubChunkChecked() in places where we know that an invalid coordinate cannot be requested
This commit is contained in:
@ -43,7 +43,7 @@ final class ChunkSerializer{
|
||||
*/
|
||||
public static function getSubChunkCount(Chunk $chunk) : int{
|
||||
for($count = $chunk->getSubChunks()->count(); $count > 0; --$count){
|
||||
if($chunk->getSubChunk($count - 1)->isEmptyFast()){
|
||||
if($chunk->getSubChunkChecked($count - 1)->isEmptyFast()){
|
||||
continue;
|
||||
}
|
||||
return $count;
|
||||
@ -56,7 +56,7 @@ final class ChunkSerializer{
|
||||
$stream = new PacketSerializer();
|
||||
$subChunkCount = self::getSubChunkCount($chunk);
|
||||
for($y = 0; $y < $subChunkCount; ++$y){
|
||||
$layers = $chunk->getSubChunk($y)->getBlockLayers();
|
||||
$layers = $chunk->getSubChunkChecked($y)->getBlockLayers();
|
||||
$stream->putByte(8); //version
|
||||
|
||||
$stream->putByte(count($layers));
|
||||
|
Reference in New Issue
Block a user