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


PHP FullChunkDataPacket::setChannel方法代码示例

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


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

示例1: sendChunk

 public function sendChunk($x, $z, $payload)
 {
     if ($this->connected === \false) {
         return;
     }
     $this->usedChunks[\PHP_INT_SIZE === 8 ? ($x & 0xffffffff) << 32 | $z & 0xffffffff : $x . ":" . $z] = \true;
     $this->chunkLoadCount++;
     $pk = new FullChunkDataPacket();
     $pk->chunkX = $x;
     $pk->chunkZ = $z;
     $pk->data = $payload;
     $this->batchDataPacket($pk->setChannel(Network::CHANNEL_WORLD_CHUNKS));
     if ($this->spawned) {
         foreach ($this->level->getChunkEntities($x, $z) as $entity) {
             if ($entity !== $this and !$entity->closed and !$entity->dead) {
                 $entity->spawnTo($this);
             }
         }
     }
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:20,代码来源:Player.php

示例2: sendChunk

 public function sendChunk($x, $z, $payload)
 {
     if ($this->connected === false) {
         return;
     }
     $this->usedChunks[Level::chunkHash($x, $z)] = true;
     $this->chunkLoadCount++;
     if ($payload instanceof DataPacket) {
         $this->dataPacket($payload);
     } else {
         $pk = new FullChunkDataPacket();
         $pk->chunkX = $x;
         $pk->chunkZ = $z;
         $pk->data = $payload;
         $this->batchDataPacket($pk->setChannel($this->spawned ? Network::CHANNEL_WORLD_CHUNKS : Network::CHANNEL_PRIORITY));
     }
     if ($this->spawned) {
         foreach ($this->level->getChunkEntities($x, $z) as $entity) {
             if ($entity !== $this and !$entity->closed and $entity->isAlive()) {
                 $entity->spawnTo($this);
             }
         }
     }
 }
开发者ID:richarrj,项目名称:PocketMine-MP,代码行数:24,代码来源:Player.php

示例3: sendChunks

 public function sendChunks($data = array())
 {
     if ($this->connected === \false) {
         return;
     }
     $bt = new BatchPacket();
     $str = "";
     foreach ($data as $set) {
         $x = $set["x"];
         $z = $set["z"];
         $payload = $set["payload"];
         $this->usedChunks[Level::chunkHash($x, $z)] = true;
         $this->chunkLoadCount++;
         $pk = new FullChunkDataPacket();
         $pk->chunkX = $x;
         $pk->chunkZ = $z;
         $pk->data = $payload;
         $pk->setChannel(Network::CHANNEL_WORLD_CHUNKS);
         $pk->encode();
         $str .= $pk->buffer;
     }
     $bt->setChannel($this->spawned ? Network::CHANNEL_WORLD_CHUNKS : Network::CHANNEL_PRIORITY);
     $bt->payload = zlib_encode($str, ZLIB_ENCODING_DEFLATE, 6);
     $bt->encode();
     $bt->isEncoded = true;
     $this->dataPacket($bt);
     foreach ($data as $set) {
         $x = $set["x"];
         $z = $set["z"];
         $payload = $set["payload"];
         if ($this->spawned) {
             foreach ($this->level->getChunkEntities($x, $z) as $entity) {
                 if ($entity !== $this and !$entity->closed and !$entity->dead) {
                     $entity->spawnTo($this);
                 }
             }
         }
     }
 }
开发者ID:xHFx,项目名称:Steadfast2,代码行数:39,代码来源:Player.php


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