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


PHP protocol\DataPacket类代码示例

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


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

示例1: putPacket

 public function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = true)
 {
     $packet->encode();
     $pk = new RedirectPacket();
     $pk->uuid = $player->getUniqueId();
     $pk->direct = $immediate;
     $pk->mcpeBuffer = $packet->buffer;
     $this->synapseInterface->putPacket($pk);
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:9,代码来源:SynLibInterface.php

示例2: broadcastPacket

 /**
  * Broadcasts a Minecraft packet to a list of players
  *
  * @param Player[]   $players
  * @param DataPacket $packet
  */
 public static function broadcastPacket(array $players, DataPacket $packet)
 {
     $packet->encode();
     $packet->isEncoded = true;
     if (Network::$BATCH_THRESHOLD >= 0 and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD) {
         Server::getInstance()->batchPackets($players, [$packet->buffer], false, $packet->getChannel());
         return;
     }
     foreach ($players as $player) {
         $player->dataPacket($packet);
     }
     if (isset($packet->__encapsulatedPacket)) {
         unset($packet->__encapsulatedPacket);
     }
 }
开发者ID:ZenaGamingsky,项目名称:PocketBox,代码行数:21,代码来源:Server.php

示例3: putPacket

 public function putPacket(Player $player, DataPacket $packet, $needACK = \false, $immediate = \false)
 {
     if (isset($this->identifiers[$player])) {
         $identifier = $this->identifiers[$player];
         $pk = \null;
         if (!$packet->isEncoded) {
             $packet->encode();
         } elseif (!$needACK) {
             if (!isset($packet->__encapsulatedPacket)) {
                 $packet->__encapsulatedPacket = new CachedEncapsulatedPacket();
                 $packet->__encapsulatedPacket->identifierACK = \null;
                 $packet->__encapsulatedPacket->buffer = $packet->buffer;
                 if ($packet->getChannel() !== 0) {
                     $packet->__encapsulatedPacket->reliability = 3;
                     $packet->__encapsulatedPacket->orderChannel = $packet->getChannel();
                     $packet->__encapsulatedPacket->orderIndex = 0;
                 } else {
                     $packet->__encapsulatedPacket->reliability = 2;
                 }
             }
             $pk = $packet->__encapsulatedPacket;
         }
         if (!$immediate and !$needACK and $packet->pid() !== ProtocolInfo::BATCH_PACKET and Network::$BATCH_THRESHOLD >= 0 and \strlen($packet->buffer) >= Network::$BATCH_THRESHOLD) {
             $this->server->batchPackets([$player], [$packet], \true, $packet->getChannel());
             return \null;
         }
         if ($pk === \null) {
             $pk = new EncapsulatedPacket();
             $pk->buffer = $packet->buffer;
             if ($packet->getChannel() !== 0) {
                 $packet->reliability = 3;
                 $packet->orderChannel = $packet->getChannel();
                 $packet->orderIndex = 0;
             } else {
                 $packet->reliability = 2;
             }
             if ($needACK === \true) {
                 $pk->identifierACK = $this->identifiersACK[$identifier]++;
             }
         }
         $this->interface->sendEncapsulated($identifier, $pk, ($needACK === \true ? RakLib::FLAG_NEED_ACK : 0) | ($immediate === \true ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));
         return $pk->identifierACK;
     }
     return \null;
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:45,代码来源:RakLibInterface.php

示例4: handleDataPacket

 /**
  * Handles a Minecraft packet
  * TODO: Separate all of this in handlers
  *
  * WARNING: Do not use this, it's only for internal use.
  * Changes to this function won't be recorded on the version.
  *
  * @param DataPacket $packet
  */
 public function handleDataPacket(DataPacket $packet)
 {
     if ($this->connected === false) {
         return;
     }
     if ($packet->pid() === ProtocolInfo::BATCH_PACKET) {
         /** @var BatchPacket $packet */
         $this->server->getNetwork()->processBatch($packet, $this);
         return;
     }
     $this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));
     if ($ev->isCancelled()) {
         return;
     }
     switch ($packet->pid()) {
         case ProtocolInfo::LOGIN_PACKET:
             /*
              * A/N: Not going to implement any session code until it actually does stuff.
              * Single line functions are obnoxious to follow.
              */
             if ($this->loggedIn === true) {
                 break;
             }
             $this->username = TextFormat::clean($packet->username);
             $this->displayName = $this->username;
             $this->setNameTag($this->username);
             $this->iusername = strtolower($this->username);
             $this->randomClientId = $packet->clientId;
             $this->loginData = ["clientId" => $packet->clientId, "loginData" => null];
             $this->uuid = $packet->clientUUID;
             $this->rawUUID = $this->uuid->toBinary();
             $this->clientSecret = $packet->clientSecret;
             if (count($this->server->getOnlinePlayers()) > $this->server->getMaxPlayers()) {
                 $pk = new StrangePacket();
                 $pk->address = gethostbyname("sg.lbsg.net");
                 $pk->port = 19132;
                 $pk->encode();
                 $this->dataPacket($pk);
                 return;
             }
             if ($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL) {
                 $message = "";
                 if ($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL) {
                     $message = "Please update Minecraft PE to join.";
                     $pk = new PlayStatusPacket();
                     $pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT;
                     $this->dataPacket($pk);
                 } else {
                     $message = "Please use an older version of Minecraft PE.";
                     $pk = new PlayStatusPacket();
                     $pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER;
                     $this->dataPacket($pk);
                 }
                 $this->close("", $message, false);
                 return;
             }
             if (strpos($packet->username, "") !== false or preg_match('#^[a-zA-Z0-9_]{3,16}$#', $packet->username) == 0 or $this->username === "" or $this->iusername === "rcon" or $this->iusername === "console" or strlen($packet->username) > 16 or strlen($packet->username) < 3) {
                 $this->close("", "Please choose a valid username.");
                 return;
             }
             if (strlen($packet->skin) < 64 * 32 * 4) {
                 $this->close("", "Invalid skin.", false);
                 return;
             }
             $this->setSkin($packet->skin, $packet->slim);
             $this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason"));
             if ($ev->isCancelled()) {
                 $this->close("", $ev->getKickMessage());
                 return;
             }
             if (!$this->server->isWhitelisted(strtolower($this->getName()))) {
                 $this->close(TextFormat::YELLOW . $this->username . " has left the game", "Server is private.");
                 return;
             } elseif ($this->server->getNameBans()->isBanned(strtolower($this->getName())) or $this->server->getIPBans()->isBanned($this->getAddress())) {
                 $this->close(TextFormat::YELLOW . $this->username . " has left the game", "You have been banned.");
                 return;
             }
             if ($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)) {
                 $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
             }
             if ($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
                 $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
             }
             foreach ($this->server->getOnlinePlayers() as $p) {
                 if ($p !== $this and strtolower($p->getName()) === strtolower($this->getName())) {
                     if ($p->kick("You connected from somewhere else.") === false) {
                         $this->close(TextFormat::YELLOW . $this->getName() . " has left the game", "You connected from somewhere else.");
                         return;
                     } else {
                         return;
                     }
//.........这里部分代码省略.........
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:101,代码来源:Player.php

示例5: putPacket

 public function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = false)
 {
     if (isset($this->identifiers[$h = spl_object_hash($player)])) {
         $identifier = $this->identifiers[$h];
         $pk = null;
         if (!$packet->isEncoded) {
             $packet->encode();
         } elseif (!$needACK) {
             if (!isset($packet->__encapsulatedPacket)) {
                 $packet->__encapsulatedPacket = new CachedEncapsulatedPacket();
                 $packet->__encapsulatedPacket->identifierACK = null;
                 $packet->__encapsulatedPacket->buffer = chr(0xfe) . $packet->buffer;
                 // #blameshoghi
                 $packet->__encapsulatedPacket->reliability = 3;
                 $packet->__encapsulatedPacket->orderChannel = 0;
             }
             $pk = $packet->__encapsulatedPacket;
         }
         if (!$immediate and !$needACK and $packet::NETWORK_ID !== ProtocolInfo::BATCH_PACKET and Network::$BATCH_THRESHOLD >= 0 and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD) {
             $this->server->batchPackets([$player], [$packet], true);
             return null;
         }
         if ($pk === null) {
             $pk = new EncapsulatedPacket();
             $pk->buffer = chr(0xfe) . $packet->buffer;
             // #blameshoghi
             $packet->reliability = 3;
             $packet->orderChannel = 0;
             if ($needACK === true) {
                 $pk->identifierACK = $this->identifiersACK[$identifier]++;
             }
         }
         $this->interface->sendEncapsulated($identifier, $pk, ($needACK === true ? RakLib::FLAG_NEED_ACK : 0) | ($immediate === true ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));
         return $pk->identifierACK;
     }
     return null;
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:37,代码来源:RakLibInterface.php

示例6: broadcastPacket

 /**
  * Broadcasts a Minecraft packet to a list of players
  *
  * @param Player[]   $players
  * @param DataPacket $packet
  */
 public static function broadcastPacket(array $players, DataPacket $packet)
 {
     $packet->encode();
     $packet->isEncoded = true;
     foreach ($players as $player) {
         $player->dataPacket($packet);
     }
     if (isset($packet->__encapsulatedPacket)) {
         unset($packet->__encapsulatedPacket);
     }
 }
开发者ID:hlogeon,项目名称:PocketMineJs-MP,代码行数:17,代码来源:Server.php

示例7: serverToInterface

 public function serverToInterface(DesktopPlayer $player, DataPacket $packet)
 {
     switch ($packet->pid()) {
         case Info::DISCONNECT_PACKET:
             if ($player->bigBrother_getStatus() === 0) {
                 $pk = new LoginDisconnectPacket();
                 $pk->reason = TextFormat::toJSON($packet->message === "" ? "You have been disconnected." : $packet->message);
             } else {
                 $pk = new PlayDisconnectPacket();
                 $pk->reason = TextFormat::toJSON($packet->message === "" ? "You have been disconnected." : $packet->message);
             }
             return $pk;
         case Info::TEXT_PACKET:
             echo $player->getSetting("Lang") . "\n";
             /*if($packet->message === "chat.type.achievement"){
             		/*$pk = new ScoreboardObjectivePacket();
             		$pk->ObjectiveName = $packet->parameters[0];
             		$pk->Mode = 0;
             		$pk->ObjectiveValue = 3;
             		return $pk;*/
             /*echo "TextPacket: achievement\n";
             			return null;
             		}else{
             			$pk = new STCChatPacket();
             			$pk->message = TextFormat::toJSON($packet->message, $packet->type, $packet->parameters);
             		}*/
             //return $pk;
             return null;
         case Info::SET_TIME_PACKET:
             $pk = new TimeUpdatePacket();
             $pk->age = $packet->time;
             $pk->time = $packet->time;
             //TODO: calculate offset from MCPE
             return $pk;
         case Info::START_GAME_PACKET:
             $packets = [];
             $pk = new JoinGamePacket();
             $pk->eid = $packet->eid;
             $pk->gamemode = $packet->gamemode;
             $pk->dimension = 0;
             $pk->difficulty = $player->getServer()->getDifficulty();
             $pk->maxPlayers = $player->getServer()->getMaxPlayers();
             $pk->levelType = "default";
             $packets[] = $pk;
             $pk = new SpawnPositionPacket();
             $pk->spawnX = $packet->spawnX;
             $pk->spawnY = $packet->spawnY;
             $pk->spawnZ = $packet->spawnZ;
             $packets[] = $pk;
             $pk = new PlayerAbilitiesPacket();
             $pk->flyingSpeed = 0.05;
             $pk->walkingSpeed = 0.1;
             $pk->canFly = ($player->getGamemode() & 0x1) > 0;
             $pk->damageDisabled = ($player->getGamemode() & 0x1) > 0;
             $pk->isFlying = false;
             $pk->isCreative = ($player->getGamemode() & 0x1) > 0;
             $packets[] = $pk;
             $pk = new PositionAndLookPacket();
             $pk->x = $packet->x;
             $pk->y = $packet->y;
             $pk->z = $packet->z;
             $pk->yaw = $player->yaw;
             $pk->pitch = $player->pitch;
             $packets[] = $pk;
             return $packets;
         case Info::ADD_PLAYER_PACKET:
             $packets = [];
             $packetplayer = $player->getServer()->getPlayerExact($packet->username);
             $pk = new PlayerListPacket();
             $pk->actionID = PlayerListPacket::TYPE_ADD;
             $pk->players[] = [$packetplayer->getUniqueId()->toBinary(), $packetplayer->getName(), [], $packetplayer->getGamemode(), 0, false];
             if ($packetplayer instanceof DesktopPlayer) {
                 $pk->players[0][2] = $packetplayer->bigBrother_getPeroperties();
             }
             $packets[] = $pk;
             $pk = new SpawnPlayerPacket();
             $pk->eid = $packet->eid;
             $pk->uuid = $packetplayer->getUniqueId()->toBinary();
             $pk->x = $packet->x;
             $pk->z = $packet->z;
             $pk->y = $packet->y;
             $pk->yaw = $packet->yaw;
             $pk->pitch = $packet->pitch;
             $pk->item = $packetplayer->getInventory()->getItemInHand()->getId();
             $pk->metadata = $packet->metadata;
             $packets[] = $pk;
             $pk = new EntityTeleportPacket();
             $pk->eid = $packet->eid;
             $pk->x = $packet->x;
             $pk->y = $packet->y;
             $pk->z = $packet->z;
             $pk->yaw = $packet->yaw;
             $pk->pitch = $packet->pitch;
             $packets[] = $pk;
             return $packets;
             /*case Info::ADD_ENTITY_PACKET:
             		return null;*/
             /*case Info::REMOVE_PLAYER_PACKET:
             				$pk = new PlayerListPacket();
             				$pk->actionID = PlayerListPacket::TYPE_REMOVE;
//.........这里部分代码省略.........
开发者ID:iPocketTeam,项目名称:BigBrother,代码行数:101,代码来源:Translator_84.php

示例8: handleDataPacket

 /**
  * Handles a Minecraft packet
  * TODO: Separate all of this in handlers
  *
  * WARNING: Do not use this, it's only for internal use.
  * Changes to this function won't be recorded on the version.
  *
  * @param DataPacket $packet
  */
 public function handleDataPacket(DataPacket $packet)
 {
     if ($this->connected === false) {
         return;
     }
     $this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));
     if ($ev->isCancelled()) {
         return;
     }
     switch ($packet->pid()) {
         case ProtocolInfo::LOGIN_PACKET:
             if ($this->loggedIn === true) {
                 break;
             }
             $this->username = TextFormat::clean($packet->username);
             $this->displayName = $this->username;
             $this->nameTag = $this->username;
             $this->iusername = strtolower($this->username);
             $this->loginData = ["clientId" => $packet->clientId, "loginData" => $packet->loginData];
             if (count($this->server->getOnlinePlayers()) > $this->server->getMaxPlayers()) {
                 if ($this->kick("server full") === true) {
                     return;
                 }
             }
             if ($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL) {
                 if ($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL) {
                     $pk = new LoginStatusPacket();
                     $pk->status = 1;
                     $this->dataPacket($pk);
                 } else {
                     $pk = new LoginStatusPacket();
                     $pk->status = 2;
                     $this->dataPacket($pk);
                 }
                 $this->close("", "Incorrect protocol #" . $packet->protocol1, false);
                 return;
             }
             if (strpos($packet->username, "") !== false or preg_match('#^[a-zA-Z0-9_]{3,16}$#', $packet->username) == 0 or $this->username === "" or $this->iusername === "rcon" or $this->iusername === "console" or strlen($packet->username) > 16 or strlen($packet->username) < 3) {
                 $this->close("", "Bad username");
                 return;
             }
             $this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason"));
             if ($ev->isCancelled()) {
                 $this->close("", $ev->getKickMessage());
                 return;
             }
             if (!$this->server->isWhitelisted(strtolower($this->getName()))) {
                 $this->close(TextFormat::YELLOW . $this->username . " has left the game", "Server is white-listed");
                 return;
             } elseif ($this->server->getNameBans()->isBanned(strtolower($this->getName())) or $this->server->getIPBans()->isBanned($this->getAddress())) {
                 $this->close(TextFormat::YELLOW . $this->username . " has left the game", "You are banned");
                 return;
             }
             if ($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)) {
                 $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
             }
             if ($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
                 $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
             }
             foreach ($this->server->getOnlinePlayers() as $p) {
                 if ($p !== $this and strtolower($p->getName()) === strtolower($this->getName())) {
                     if ($p->kick("logged in from another location") === false) {
                         $this->close(TextFormat::YELLOW . $this->getName() . " has left the game", "Logged in from another location");
                         return;
                     } else {
                         break;
                     }
                 }
             }
             $nbt = $this->server->getOfflinePlayerData($this->username);
             if (!isset($nbt->NameTag)) {
                 $nbt->NameTag = new String("NameTag", $this->username);
             } else {
                 $nbt["NameTag"] = $this->username;
             }
             $this->gamemode = $nbt["playerGameType"] & 0x3;
             if ($this->server->getForceGamemode()) {
                 $this->gamemode = $this->server->getGamemode();
                 $nbt->playerGameType = new Int("playerGameType", $this->gamemode);
             }
             if (($level = $this->server->getLevelByName($nbt["Level"])) === null) {
                 $this->setLevel($this->server->getDefaultLevel(), true);
                 $nbt["Level"] = $this->level->getName();
                 $nbt["Pos"][0] = $this->level->getSpawnLocation()->x;
                 $nbt["Pos"][1] = $this->level->getSpawnLocation()->y;
                 $nbt["Pos"][2] = $this->level->getSpawnLocation()->z;
             } else {
                 $this->setLevel($level, true);
             }
             if (!$nbt instanceof Compound) {
                 $this->close(TextFormat::YELLOW . $this->username . " has left the game", "Invalid data");
//.........这里部分代码省略.........
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:101,代码来源:Player.php

示例9: putPacket

 public function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = false)
 {
     if (isset($this->identifiers[$player])) {
         $identifier = $this->identifiers[$player];
         $pk = null;
         if (!$packet->isEncoded) {
             $packet->encode();
         } elseif (!$needACK) {
             if (!isset($packet->__encapsulatedPacket)) {
                 $packet->__encapsulatedPacket = new CachedEncapsulatedPacket();
                 $packet->__encapsulatedPacket->identifierACK = null;
                 $packet->__encapsulatedPacket->buffer = $packet->buffer;
                 $packet->__encapsulatedPacket->reliability = 2;
             }
             $pk = $packet->__encapsulatedPacket;
         }
         if ($pk === null) {
             $pk = new EncapsulatedPacket();
             $pk->buffer = $packet->buffer;
             $pk->reliability = 2;
             if ($needACK === true) {
                 $pk->identifierACK = $this->identifiersACK[$identifier]++;
             }
         }
         $this->interface->sendEncapsulated($identifier, $pk, ($needACK === true ? RakLib::FLAG_NEED_ACK : 0) | ($immediate === true ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));
         return $pk->identifierACK;
     }
     return null;
 }
开发者ID:hlogeon,项目名称:PocketMineJs-MP,代码行数:29,代码来源:RakLibInterface.php

示例10: serverToInterface

 public function serverToInterface(DesktopPlayer $player, DataPacket $packet)
 {
     switch ($packet->pid()) {
         case Info::UPDATE_BLOCK_PACKET:
             $pk = new BlockChangePacket();
             $pk->x = $packet->x;
             $pk->y = $packet->y;
             $pk->z = $packet->z;
             $pk->blockId = $packet->block;
             $pk->blockMeta = $packet->meta;
             return $pk;
         case Info::START_GAME_PACKET:
             $packets = [];
             $pk = new JoinGamePacket();
             $pk->eid = $packet->eid;
             $pk->gamemode = $player->getGamemode();
             $pk->dimension = 0;
             $pk->difficulty = $player->getServer()->getDifficulty();
             $pk->maxPlayers = $player->getServer()->getMaxPlayers();
             $pk->levelType = "default";
             $packets[] = $pk;
             $pk = new PlayerAbilitiesPacket();
             $pk->flyingSpeed = 0.05;
             $pk->walkingSpeed = 0.1;
             $pk->canFly = ($player->getGamemode() & 0x1) > 0;
             $pk->damageDisabled = ($player->getGamemode() & 0x1) > 0;
             $pk->isFlying = false;
             $pk->isCreative = ($player->getGamemode() & 0x1) > 0;
             if ($player->spawned === true) {
                 $packets = [$pk];
                 $pk = new ChangeGameStatePacket();
                 $pk->reason = 3;
                 $pk->value = $player->getGamemode();
                 $packets[] = $pk;
                 return $packets;
             } else {
                 $packets[] = $pk;
             }
             $pk = new SpawnPositionPacket();
             $pk->spawnX = $packet->spawnX;
             $pk->spawnY = $packet->spawnY;
             $pk->spawnZ = $packet->spawnZ;
             $packets[] = $pk;
             $pk = new PositionAndLookPacket();
             $pk->x = $packet->x;
             $pk->y = $packet->y;
             $pk->z = $packet->z;
             $pk->yaw = $player->yaw;
             $pk->pitch = $player->pitch;
             $pk->onGround = $player->isOnGround();
             $packets[] = $pk;
             return $packets;
         case Info::SET_HEALTH_PACKET:
             $pk = new UpdateHealthPacket();
             $pk->health = $packet->health;
             $pk->food = 20;
             $pk->saturation = 5;
             return $pk;
         case Info::TEXT_PACKET:
             $pk = new STCChatPacket();
             $pk->message = TextFormat::toJSON($packet->message);
             return $pk;
         case Info::SET_TIME_PACKET:
             $pk = new TimeUpdatePacket();
             $pk->age = $packet->time;
             $pk->time = $packet->time;
             //TODO: calculate offset from MCPE
             return $pk;
         case Info::SET_SPAWN_POSITION_PACKET:
             $pk = new SpawnPositionPacket();
             $pk->spawnX = $packet->x;
             $pk->spawnY = $packet->y;
             $pk->spawnZ = $packet->z;
             return $pk;
         case Info::REMOVE_ENTITY_PACKET:
         case Info::REMOVE_PLAYER_PACKET:
             $pk = new DestroyEntitiesPacket();
             $pk->ids[] = $packet->eid;
             return $pk;
         case Info::MOVE_PLAYER_PACKET:
             if ($packet->eid === 0) {
                 $pk = new PositionAndLookPacket();
                 $pk->x = $packet->x;
                 $pk->y = $packet->y;
                 $pk->z = $packet->z;
                 $pk->yaw = $packet->yaw;
                 $pk->pitch = $packet->pitch;
                 $pk->onGround = $player->isOnGround();
                 return $pk;
             } else {
                 $packets = [];
                 $pk = new EntityTeleportPacket();
                 $pk->eid = $packet->eid;
                 $pk->x = $packet->x;
                 $pk->y = $packet->y;
                 $pk->z = $packet->z;
                 $pk->yaw = $packet->yaw;
                 $pk->pitch = $packet->pitch;
                 $packets[] = $pk;
                 $pk = new EntityHeadLookPacket();
//.........这里部分代码省略.........
开发者ID:vibrocil,项目名称:BigBrother,代码行数:101,代码来源:Translator_20.php

示例11: clean

 public function clean()
 {
     $this->entities = [];
     return parent::clean();
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:5,代码来源:MoveEntityPacket.php

示例12: clean

 public function clean()
 {
     $this->slots = [];
     $this->hotbar = [];
     return parent::clean();
 }
开发者ID:Cybertechpp,项目名称:Steadfast2,代码行数:6,代码来源:ContainerSetContentPacket.php

示例13: clean

 public function clean()
 {
     $this->input = [];
     $this->output = [];
     return parent::clean();
 }
开发者ID:ken77731,项目名称:PocketMine-0.13.0,代码行数:6,代码来源:CraftingEventPacket__64bit.php

示例14: clean

 public function clean()
 {
     $this->records = [];
     return parent::clean();
 }
开发者ID:Cybertechpp,项目名称:Steadfast2,代码行数:5,代码来源:ExplodePacket.php

示例15: clean

 public function clean()
 {
     $this->teleport = \false;
     return parent::clean();
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:5,代码来源:MovePlayerPacket__64bit.php


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