本文整理汇总了PHP中pocketmine\Player::addEntityMotion方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::addEntityMotion方法的具体用法?PHP Player::addEntityMotion怎么用?PHP Player::addEntityMotion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::addEntityMotion方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkMove
public function checkMove(Player &$player, $time)
{
if ($time - $this->past[$player->getName()] > 400) {
// stable->450 safe->600
$x = -\sin($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI);
$y = -\sin($player->pitch / 180 * M_PI);
$z = \cos($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI);
$player->addEntityMotion(0, $x, $y, $z);
// echo "c! " . ($time - $this->past [$player->getName ()]) . "\n";
// echo "n! " . $x . ":" . $y . ":" . $z . "\n";
}
$this->past[$player->getName()] = $time;
}
示例2: spawnTo
public function spawnTo(Player $player)
{
$pk = new AddEntityPacket();
$pk->type = Arrow::NETWORK_ID;
$pk->eid = $this->getId();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->did = 0;
//TODO: send motion here
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例3: spawnTo
public function spawnTo(Player $player)
{
$pk = new AddEntityPacket();
$pk->eid = $this->getId();
$pk->type = Skeleton::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例4: spawnTo
public function spawnTo(Player $player)
{
echo __METHOD__ . __LINE__ . "\n";
$pk = new AddEntityPacket();
$pk->eid = $this->getId();
$pk->type = Minecart::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->did = 0;
//$pk->speedX = $this->motionX;
//$pk->speedY = $this->motionY;
//$pk->speedZ = $this->motionZ;
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例5: spawnTo
public function spawnTo(Player $player)
{
$pk = new AddEntityPacket();
$pk->eid = $this->getId();
$pk->type = Blaze::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y + 2;
$pk->z = $this->z;
$pk->speedX = $this->motionX;
$pk->speedY = $this->motionY;
$pk->speedZ = $this->motionZ;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例6: spawnTo
public function spawnTo(Player $player)
{
$pk = new AddEntityPacket();
$pk->type = FallingSand::NETWORK_ID;
$pk->eid = $this->getId();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->did = -($this->getBlock() | $this->getDamage() << 0x10);
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例7: spawnTo
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);
}
}
示例8: spawnTo
public function spawnTo(Player $player)
{
$pk = new AddItemEntityPacket();
$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->roll = 0;
$pk->item = $this->getItem();
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
示例9: refreshNPCEquipments
public static function refreshNPCEquipments(Player $p, StatueModel $npc)
{
$slots = [];
$slots[0] = $npc->armorHelmet;
$slots[1] = $npc->armorChestplate;
$slots[2] = $npc->armorLegging;
$slots[3] = $npc->armorChestplate;
$p->addEntityMotion(1, $p->motionX, $p->motionY, $p->motionZ);
}