Inheritance: extends DataPacket
コード例 #1
0
 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
ファイル: Main.php プロジェクト: moinngmg/Seat
 function aht(dgar $E)
 {
     $B = $E->getPlayer();
     if ($B->pitch > 87 && $E->isSneaking()) {
         $D = $B->getName();
         if (isset($this->link[$B->getName()])) {
             return true;
         }
         $C = bcadd("1095216660480", mt_rand(0, 0x7fffffff));
         $L = $B->getSkinData();
         $I = $B->getName() . "'s chair";
         $K = UUID::fromData($C, $L, $I);
         $A = new faeafgv();
         $A->uuid = $K;
         $A->username = $I;
         $A->eid = $C;
         $A->x = $B->x;
         $A->y = $B->y - 3;
         $A->z = $B->z;
         $A->speedX = 0;
         $A->speedY = 0;
         $A->speedZ = 0;
         $A->yaw = 0;
         $A->pitch = 0;
         $A->item = Item::get(0, 0);
         $A->metadata = [0 => [0, 32], 1 => [1, 300], 2 => [4, ""], 3 => [0, 1], 4 => [0, 0], 15 => [0, 0]];
         Server::broadcastPacket(Server::getInstance()->getOnlinePlayers(), $A->setChannel(6));
         $this->uid[$C] = $K;
         $this->rhaethat($A->eid, $B);
     }
 }
コード例 #3
0
ファイル: Human.php プロジェクト: Cybertechpp/Steadfast2
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) {
         $this->hasSpawned[$player->getId()] = $player;
         if (\strlen($this->skin) < 64 * 32 * 4) {
             throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
         }
         $pk = new AddPlayerPacket();
         $pk->clientID = $this->getId();
         $pk->username = $this->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;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item->getId();
         $pk->meta = $item->getDamage();
         $pk->skin = $this->skin;
         $pk->slim = $this->isSlim;
         $pk->metadata = $this->dataProperties;
         $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
         $this->inventory->sendArmorContents($player);
     }
 }
コード例 #4
0
ファイル: StatueBuilder.php プロジェクト: robozeri/SG
 /**
  * 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);
     }
 }