当前位置: 首页>>代码示例>>PHP>>正文


PHP Binary::readLInt方法代码示例

本文整理汇总了PHP中pocketmine\utils\Binary::readLInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Binary::readLInt方法的具体用法?PHP Binary::readLInt怎么用?PHP Binary::readLInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\utils\Binary的用法示例。


在下文中一共展示了Binary::readLInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: readPacket

 private function readPacket($client, &$size, &$requestID, &$packetType, &$payload)
 {
     socket_set_nonblock($client);
     $d = socket_read($client, 4);
     if ($this->stop === true) {
         return false;
     } elseif ($d === false) {
         return null;
     } elseif ($d === "" or strlen($d) < 4) {
         return false;
     }
     socket_set_block($client);
     $size = Binary::readLInt($d);
     if ($size < 0 or $size > 65535) {
         return false;
     }
     $requestID = Binary::readLInt(socket_read($client, 4));
     $packetType = Binary::readLInt(socket_read($client, 4));
     $payload = rtrim(socket_read($client, $size + 2));
     //Strip two null bytes
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:22,代码来源:RCONInstance.php

示例2: getLInt

 public function getLInt()
 {
     return Binary::readLInt($this->get(4));
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:4,代码来源:BinaryStream.php

示例3: parseChunk

 public function parseChunk($X, $Z)
 {
     $X = (int) $X;
     $Z = (int) $Z;
     $offset = $this->getOffset($X, $Z);
     $len = Binary::readLInt(substr($this->raw, $offset, 4));
     $offset += 4;
     $chunk = [0 => [], 1 => [], 2 => [], 3 => []];
     foreach ($chunk as $section => &$data) {
         $l = $section === 0 ? 128 : 64;
         for ($i = 0; $i < 256; ++$i) {
             $data[$i] = substr($this->raw, $offset, $l);
             $offset += $l;
         }
     }
     return $chunk;
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:17,代码来源:PocketChunkParser.php

示例4: getInt

 public function getInt()
 {
     return $this->endianness === self::BIG_ENDIAN ? Binary::readInt($this->get(4)) : Binary::readLInt($this->get(4));
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:4,代码来源:NBT.php

示例5: fromBinary

 /**
  * @param string        $data
  * @param LevelProvider $provider
  *
  * @return Chunk
  */
 public static function fromBinary($data, LevelProvider $provider = null)
 {
     try {
         $chunkX = Binary::readLInt(substr($data, 0, 4));
         $chunkZ = Binary::readLInt(substr($data, 4, 4));
         $chunkData = substr($data, 8, -1);
         $flags = ord(substr($data, -1));
         $entities = null;
         $tiles = null;
         if ($provider instanceof LevelDB) {
             $nbt = new NBT(NBT::LITTLE_ENDIAN);
             $entityData = $provider->getDatabase()->get(substr($data, 0, 8) . "2");
             if ($entityData !== false and strlen($entityData) > 0) {
                 $nbt->read($entityData, true);
                 $entities = $nbt->getData();
                 if (!is_array($entities)) {
                     $entities = [$entities];
                 }
             }
             $tileData = $provider->getDatabase()->get(substr($data, 0, 8) . "1");
             if ($tileData !== false and strlen($tileData) > 0) {
                 $nbt->read($tileData, true);
                 $tiles = $nbt->getData();
                 if (!is_array($tiles)) {
                     $tiles = [$tiles];
                 }
             }
         }
         $chunk = new Chunk($provider instanceof LevelProvider ? $provider : LevelDB::class, $chunkX, $chunkZ, $chunkData, $entities, $tiles);
         if ($flags & 0x1) {
             $chunk->setGenerated();
         }
         if ($flags & 0x2) {
             $chunk->setPopulated();
         }
         return $chunk;
     } catch (\Exception $e) {
         return null;
     }
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:46,代码来源:Chunk.php

示例6: getInt

 public function getInt(bool $network = false)
 {
     if ($network === true) {
         return Binary::readVarInt($this);
     }
     return $this->endianness === self::BIG_ENDIAN ? Binary::readInt($this->get(4)) : Binary::readLInt($this->get(4));
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:7,代码来源:NBT.php


注:本文中的pocketmine\utils\Binary::readLInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。