本文整理汇总了PHP中pocketmine\Player::spawnTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::spawnTo方法的具体用法?PHP Player::spawnTo怎么用?PHP Player::spawnTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::spawnTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spawnTo
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);
}
}
示例2: showPlayer
/**
* @param Player $player
*/
public function showPlayer(Player $player)
{
if ($player === $this) {
return;
}
unset($this->hiddenPlayers[$player->getRawUniqueId()]);
if ($player->isOnline()) {
$player->spawnTo($this);
}
}