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


PHP FullChunkDataPacket::getBuffer方法代码示例

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


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

示例1: getChunkCacheFromData

 /**
  * @param $chunkX
  * @param $chunkZ
  * @param $payload
  *
  * @return DataPacket
  */
 public static function getChunkCacheFromData($chunkX, $chunkZ, $payload, $ordering = FullChunkDataPacket::ORDER_COLUMNS)
 {
     $pk = new FullChunkDataPacket();
     $pk->chunkX = $chunkX;
     $pk->chunkZ = $chunkZ;
     $pk->order = $ordering;
     $pk->data = $payload;
     $pk->encode();
     $batch = new BatchPacket();
     $batch->payload = zlib_encode(Binary::writeInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);
     $batch->encode();
     $batch->isEncoded = true;
     return $batch;
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:21,代码来源:Player.php

示例2: getChunkCacheFromData

 /**
  * @param $chunkX
  * @param $chunkZ
  * @param $payload
  *
  * @return DataPacket
  */
 public static function getChunkCacheFromData($chunkX, $chunkZ, $payload)
 {
     $pk = new FullChunkDataPacket();
     $pk->chunkX = $chunkX;
     $pk->chunkZ = $chunkZ;
     $pk->data = $payload;
     $pk->encode();
     $batch = new BatchPacket();
     $batch->payload = zlib_encode($pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);
     $batch->setChannel(Network::CHANNEL_WORLD_CHUNKS);
     $batch->encode();
     $batch->isEncoded = true;
     return $batch;
 }
开发者ID:richarrj,项目名称:PocketMine-MP,代码行数:21,代码来源:Player.php


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