當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Player::addEntityMotion方法代碼示例

本文整理匯總了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;
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:13,代碼來源:StartDASH.php

示例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);
 }
開發者ID:Edwardthedog2,項目名稱:Steadfast2,代碼行數:14,代碼來源:Arrow.php

示例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);
 }
開發者ID:misha1,項目名稱:MyOwnWorld,代碼行數:15,代碼來源:Skeleton.php

示例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);
 }
開發者ID:AvivShopen,項目名稱:bad-plugins,代碼行數:17,代碼來源:Minecart.php

示例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);
 }
開發者ID:xpyctum,項目名稱:PocketMinePlusPlus,代碼行數:18,代碼來源:Blaze.php

示例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);
 }
開發者ID:hlogeon,項目名稱:PocketMineJs-MP,代碼行數:13,代碼來源:FallingSand.php

示例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);
     }
 }
開發者ID:rryy,項目名稱:PocketMine-MP,代碼行數:26,代碼來源:Human.php

示例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);
 }
開發者ID:rryy,項目名稱:PocketMine-MP,代碼行數:15,代碼來源:Item.php

示例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);
 }
開發者ID:robozeri,項目名稱:SG,代碼行數:9,代碼來源:StatueBuilder.php


注:本文中的pocketmine\Player::addEntityMotion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。