58    public static function create(
ChunkPosition $chunkPosition, 
int $dimensionId, 
int $subChunkCount, 
bool $clientSubChunkRequestsEnabled, ?array $usedBlobHashes, 
string $extraPayload) : self{
 
   60        $result->chunkPosition = $chunkPosition;
 
   61        $result->dimensionId = $dimensionId;
 
   62        $result->subChunkCount = $subChunkCount;
 
   63        $result->clientSubChunkRequestsEnabled = $clientSubChunkRequestsEnabled;
 
   64        $result->usedBlobHashes = $usedBlobHashes;
 
   65        $result->extraPayload = $extraPayload;
 
 
   98        $this->dimensionId = VarInt::readSignedInt($in);
 
  100        $subChunkCountButNotReally = VarInt::readUnsignedInt($in);
 
  101        if($subChunkCountButNotReally === self::CLIENT_REQUEST_FULL_COLUMN_FAKE_COUNT){
 
  102            $this->clientSubChunkRequestsEnabled = 
true;
 
  103            $this->subChunkCount = PHP_INT_MAX;
 
  104        }elseif($subChunkCountButNotReally === self::CLIENT_REQUEST_TRUNCATED_COLUMN_FAKE_COUNT){
 
  105            $this->clientSubChunkRequestsEnabled = 
true;
 
  106            $this->subChunkCount = LE::readUnsignedShort($in);
 
  108            $this->clientSubChunkRequestsEnabled = 
false;
 
  109            $this->subChunkCount = $subChunkCountButNotReally;
 
  112        $cacheEnabled = CommonTypes::getBool($in);
 
  114            $this->usedBlobHashes = [];
 
  115            $count = VarInt::readUnsignedInt($in);
 
  116            if($count > self::MAX_BLOB_HASHES){
 
  117                throw new PacketDecodeException(
"Expected at most " . self::MAX_BLOB_HASHES . 
" blob hashes, got " . $count);
 
  119            for($i = 0; $i < $count; ++$i){
 
  120                $this->usedBlobHashes[] = LE::readUnsignedLong($in);
 
  123        $this->extraPayload = CommonTypes::getString($in);
 
 
  127        $this->chunkPosition->write($out);
 
  128        VarInt::writeSignedInt($out, $this->dimensionId);
 
  130        if($this->clientSubChunkRequestsEnabled){
 
  131            if($this->subChunkCount === PHP_INT_MAX){
 
  132                VarInt::writeUnsignedInt($out, self::CLIENT_REQUEST_FULL_COLUMN_FAKE_COUNT);
 
  134                VarInt::writeUnsignedInt($out, self::CLIENT_REQUEST_TRUNCATED_COLUMN_FAKE_COUNT);
 
  135                LE::writeUnsignedShort($out, $this->subChunkCount);
 
  138            VarInt::writeUnsignedInt($out, $this->subChunkCount);
 
  141        CommonTypes::putBool($out, $this->usedBlobHashes !== 
null);
 
  142        if($this->usedBlobHashes !== 
null){
 
  143            VarInt::writeUnsignedInt($out, count($this->usedBlobHashes));
 
  144            foreach($this->usedBlobHashes as $hash){
 
  145                LE::writeUnsignedLong($out, $hash);
 
  148        CommonTypes::putString($out, $this->extraPayload);