Exemplo n.º 1
0
 public function spawnTo(Player $player)
 {
     if (isset($this->hasSpawned[$player->getLoaderId()]) or !isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])) {
         return;
     }
     if (!$this->dummyReceiver instanceof DummyReceiver) {
         return;
     }
     $pk = new AddPlayerPacket();
     $pk->uuid = $this->dummyReceiver->randomUUID;
     $pk->username = $this->dummyReceiver->getName();
     $pk->eid = $this->getId();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->speedX = $this->motionX;
     $pk->speedY = $this->motionY;
     $pk->speedZ = $this->motionZ;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->item = Item::get(Item::DIAMOND_PICKAXE);
     $pk->metadata = $this->dummyReceiver->getDataProperties();
     $player->dataPacket($pk);
     $this->dummyReceiver->getInventory()->sendArmorContents($player);
     if (!$this instanceof Player) {
         $this->server->removePlayerListData($this->dummyReceiver->randomUUID, [$player]);
     }
     $this->hasSpawned[$player->getLoaderId()] = $player;
 }