public function spawnTo(Player $player) { if ($player instanceof DesktopPlayer) { if ($this !== $player and $this->spawned === true and $player->getLevel() === $this->getLevel() and $player->canSee($this)) { $this->hasSpawned[$player->getID()] = $player; $pk = new SpawnPlayerPacket(); if ($player->getRemoveFormat()) { $pk->name = TextFormat::clean($this->nameTag); } else { $pk->name = $this->nameTag; } $pk->eid = $this->getID(); $pk->uuid = $this->bigBrother_formatedUUID; $pk->x = $this->x; $pk->z = $this->y; $pk->y = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->item = $this->inventory->getItemInHand()->getID(); $pk->metadata = $this->getData(); $pk->data = $this->bigBrother_properties; $player->putRawPacket($pk); $pk = new EntityTeleportPacket(); $pk->eid = $this->getID(); $pk->x = $this->x; $pk->z = $this->y; $pk->y = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $player->putRawPacket($pk); $pk = new SetEntityMotionPacket(); $pk->eid = $this->getID(); $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $player->dataPacket($pk); $this->inventory->sendHeldItem($player); $this->inventory->sendArmorContents($player); } } else { parent::spawnTo($player); } }
public function spawnTo(Player $player) { if ($player !== $this and !isset($this->hasSpawned[$player->getID()])) { $this->hasSpawned[$player->getID()] = $player; $pk = new AddPlayerPacket(); $pk->clientID = 0; if ($player->getRemoveFormat()) { $pk->username = TextFormat::clean($this->nameTag); } else { $pk->username = $this->nameTag; } $pk->eid = $this->getID(); $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->unknown1 = 0; $pk->unknown2 = 0; $pk->metadata = $this->getData(); $player->dataPacket($pk); $pk = new SetEntityMotionPacket(); $pk->entities = [[$this->getID(), $this->motionX, $this->motionY, $this->motionZ]]; $player->dataPacket($pk); $this->inventory->sendHeldItem($player); $this->inventory->sendArmorContents($player); } }
public function spawnTo(Player $player) { if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) { $this->hasSpawned[$player->getId()] = $player; $pk = new AddPlayerPacket(); $pk->clientID = 0; if ($player->getRemoveFormat()) { $pk->username = TextFormat::clean($this->nameTag); } else { $pk->username = $this->nameTag; } $pk->eid = $this->getId(); $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $item = $this->getInventory()->getItemInHand(); $pk->item = $item->getId(); $pk->meta = $item->getDamage(); $pk->metadata = $this->getData(); $player->dataPacket($pk); $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ); $this->inventory->sendArmorContents($player); } }