public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
         $this->hasSpawned[$player->getLoaderId()] = $player;
         $pk = new AddPlayerPacket();
         $pk->uuid = $this->getUniqueId();
         $pk->username = $this->getName();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->speedX = 0;
         $pk->speedY = 0;
         $pk->speedZ = 0;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item;
         if ($player->hasPermission("slapper.seeownskin")) {
             $pk->skin = $player->getSkinData();
             $pk->slim = $player->isSkinSlim();
         } else {
             $pk->skin = $this->skin;
             $pk->slim = $this->isSlim;
         }
         $pk->metadata = [2 => [4, $this->getDataProperty(2)], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
         $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
         $this->inventory->sendArmorContents($player);
     }
 }
示例#2
0
 public function addOnlinePlayer(Player $player)
 {
     $this->playerList[$player->getRawUniqueId()] = $player;
     $this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->isSkinSlim(), $player->getSkinFlag(), $player->getSkinData());
 }
 /** 
  * @param Player $player 
  */
 public function storeSkinData(Player $player)
 {
     $this->skinData[strtolower($player->getName())] = $player->getSkinData();
 }
 /** 
  * @param Player $player 
  */
 public function storeSkinData(Player $player)
 {
     $this->skinData[strtolower($player->getName())] = SkinConverter::compress($player->getSkinData());
 }
示例#5
0
 /**
  * Send NPC Players
  *
  * @param StatueModel $statue        	
  * @param Player $player        	
  * @internal param unknown $modId
  * @internal param Player $p
  */
 public function spawnStatue(StatueModel $statue, Player $player)
 {
     $slots = [];
     $slots[0] = $statue->armorHelmet;
     $slots[1] = $statue->armorChestplate;
     $slots[2] = $statue->armorLegging;
     $slots[3] = $statue->armorBoots;
     // $eid = rand ( 101, 9900 );
     $pk = new AddPlayerPacket();
     $pk->clientID = rand(101, 9999);
     $pk->username = $statue->displayName;
     $pk->eid = $statue->eid;
     $pk->x = $statue->position->x + 0.5;
     $pk->y = $statue->position->y;
     $pk->z = $statue->position->z + 0.5;
     $pk->yaw = 0;
     $pk->pitch = 0;
     $pk->unknown1 = 0;
     $pk->unknown2 = 0;
     $pk->item = $statue->itemOnHand;
     $pk->meta = 0;
     $pk->metadata = [];
     $pk->skin = $player->getSkinData();
     $pk->encode();
     $player->dataPacket($pk);
     Server::broadcastPacket($player->getViewers(), $pk);
     $player->addEntityMotion($statue->eid, 64, 290, 0);
     if ($slots != null) {
         $pk = new PlayerArmorEquipmentPacket();
         $pk->eid = $statue->eid;
         $pk->slots = $slots;
         $pk->encode();
         $pk->isEncoded = true;
         $player->dataPacket($pk);
         Server::broadcastPacket($player->getViewers(), $pk);
     }
 }