encode() abstract public method

abstract public encode ( ) : DataPacket | DataPacket[]
return pocketmine\network\protocol\DataPacket | pocketmine\network\protocol\DataPacket[]
コード例 #1
0
ファイル: Level.php プロジェクト: TylerGames/PocketMine-MP
 public function addSound(Sound $sound, array $players = null)
 {
     $pk = $sound->encode();
     if ($players === null) {
         $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4);
     }
     if ($pk !== null) {
         if (!is_array($pk)) {
             Server::broadcastPacket($players, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
         } else {
             $this->server->batchPackets($players, $pk, false, Network::CHANNEL_WORLD_EVENTS);
         }
     }
 }
コード例 #2
0
ファイル: Level.php プロジェクト: RedstoneAlmeida/Steadfast2
 public function addSound(Sound $sound, array $players = null)
 {
     $pk = $sound->encode();
     if ($players === null) {
         $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4);
     }
     if ($pk !== null) {
         if (!is_array($pk)) {
             Server::broadcastPacket($players, $pk);
         } else {
             $this->server->batchPackets($players, $pk, false);
         }
     }
 }
コード例 #3
0
ファイル: Level.php プロジェクト: xpyctum/PocketMinePlusPlus
 public function addSound(Sound $sound, array $players = \null)
 {
     $pk = $sound->encode();
     if ($players === \null) {
         if ($pk !== \null) {
             if (!\is_array($pk)) {
                 $this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $pk);
             } else {
                 foreach ($pk as $e) {
                     $this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $e);
                 }
             }
         }
     } else {
         if ($pk !== \null) {
             if (!\is_array($pk)) {
                 Server::broadcastPacket($players, $pk);
             } else {
                 $this->server->batchPackets($players, $pk, \false);
             }
         }
     }
 }