本文整理汇总了PHP中pocketmine\Player::getLoaderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getLoaderId方法的具体用法?PHP Player::getLoaderId怎么用?PHP Player::getLoaderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::getLoaderId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spawnTo
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: spawnTo
public function spawnTo(Player $player)
{
if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
$this->hasSpawned[$player->getLoaderId()] = $player;
$uuid = $this->getUniqueId();
$entityId = $this->getId();
$pk = new AddPlayerPacket();
$pk->uuid = $uuid;
$pk->username = "";
$pk->eid = $entityId;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->item = $this->getInventory()->getItemInHand();
$pk->metadata = [2 => [4, str_ireplace("{name}", $player->getName(), str_ireplace("{display_name}", $player->getDisplayName(), $player->hasPermission("slapper.seeId") ? $this->getDataProperty(2) . "\n" . \pocketmine\utils\TextFormat::GREEN . "Entity ID: " . $entityId : $this->getDataProperty(2)))], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
$player->dataPacket($pk);
$this->inventory->sendArmorContents($player);
$add = new PlayerListPacket();
$add->type = 0;
$add->entries[] = [$uuid, $entityId, isset($this->namedtag->MenuName) ? $this->namedtag["MenuName"] : "", $this->skinName, $this->skin];
$player->dataPacket($add);
if ($this->namedtag["MenuName"] === "") {
$remove = new PlayerListPacket();
$remove->type = 1;
$remove->entries[] = [$uuid];
$player->dataPacket($remove);
}
}
}
示例3: spawnTo
public function spawnTo(Player $player)
{
if (!isset($this->hasSpawned[$player->getLoaderId()]) && isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])) {
$pk = new AddEntityPacket();
$pk->eid = $this->getID();
$pk->type = static::NETWORK_ID;
$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;
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk);
$this->hasSpawned[$player->getLoaderId()] = $player;
}
}
示例4: requestChunk
public function requestChunk($x, $z, Player $player)
{
$index = Level::chunkHash($x, $z);
if (!isset($this->chunkSendQueue[$index])) {
$this->chunkSendQueue[$index] = [];
}
$this->chunkSendQueue[$index][$player->getLoaderId()] = $player;
}
示例5: despawnFrom
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getLoaderId()])) {
$pk = new RemoveEntityPacket();
$pk->eid = $this->getId();
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getLoaderId()]);
}
}
示例6: despawnFrom
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getLoaderId()])) {
if ($this instanceof Player) {
$this->server->removePlayerListData($this->getUniqueId(), [$player]);
}
$pk = new RemovePlayerPacket();
$pk->eid = $this->getId();
$pk->clientId = $this->getUniqueId();
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getLoaderId()]);
}
}
示例7: spawnTo
/**
* @param Player $player
*/
public function spawnTo(Player $player)
{
if (!isset($this->hasSpawned[$player->getLoaderId()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])) {
$this->hasSpawned[$player->getLoaderId()] = $player;
}
}
示例8: onActivate
public function onActivate(Item $item, Player $player = null)
{
if (($this->getDamage() & 0x8) === 0x8) {
//Top
$down = $this->getSide(Vector3::SIDE_DOWN);
if ($down->getId() === $this->getId()) {
$meta = $down->getDamage() ^ 0x4;
$this->getLevel()->setBlock($down, Block::get($this->getId(), $meta), true);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if ($player instanceof Player) {
unset($players[$player->getLoaderId()]);
}
$this->level->addSound(new DoorSound($this));
return true;
}
return false;
} else {
$this->meta ^= 0x4;
$this->getLevel()->setBlock($this, $this, true);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if ($player instanceof Player) {
unset($players[$player->getLoaderId()]);
}
$this->level->addSound(new DoorSound($this));
}
return true;
}
示例9: requestChunk
public function requestChunk($x, $z, Player $player)
{
$index = \PHP_INT_SIZE === 8 ? ($x & 0xffffffff) << 32 | $z & 0xffffffff : $x . ":" . $z;
if (!isset($this->chunkSendQueue[$index])) {
$this->chunkSendQueue[$index] = [];
}
$this->chunkSendQueue[$index][$player->getLoaderId()] = $player;
}
示例10: requestChunk
public function requestChunk($x, $z, Player $player)
{
$index = ($x & 0xffffffff) << 32 | $z & 0xffffffff;
if (!isset($this->chunkSendQueue[$index])) {
$this->chunkSendQueue[$index] = [];
}
$this->chunkSendQueue[$index][$player->getLoaderId()] = $player;
}
示例11: despawnFrom
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getLoaderId()])) {
$pk = new RemovePlayerPacket();
$pk->eid = $this->getId();
$pk->clientID = $this->getId();
$player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
unset($this->hasSpawned[$player->getLoaderId()]);
}
}
示例12: despawnFrom
/**
*
* @param Player $player
*/
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getLoaderId()])) {
$pk = new RemovePlayerPacket();
$pk->eid = $this->getId();
$pk->clientId = $this->dummyReceiver->randomUUID;
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getLoaderId()]);
}
}