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


PHP Player::getEyeHeight方法代碼示例

本文整理匯總了PHP中pocketmine\Player::getEyeHeight方法的典型用法代碼示例。如果您正苦於以下問題:PHP Player::getEyeHeight方法的具體用法?PHP Player::getEyeHeight怎麽用?PHP Player::getEyeHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\Player的用法示例。


在下文中一共展示了Player::getEyeHeight方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: burstArrow

 public function burstArrow(Player $player)
 {
     if ($player->getInventory()->getItemInHand()->getId() === Item::BOW) {
         $bow = $player->getInventory()->getItemInHand();
         $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $player->x), new Double("", $player->y + $player->getEyeHeight()), new Double("", $player->z)]), "Motion" => new Enum("Motion", [new Double("", -\sin($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI)), new Double("", -\sin($player->pitch / 180 * M_PI)), new Double("", \cos($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI))]), "Rotation" => new Enum("Rotation", [new Float("", $player->yaw), new Float("", $player->pitch)])]);
         $ev = new EntityShootBowEvent($player, $bow, Entity::createEntity("Arrow", $player->chunk, $nbt, $player), 1.5);
         $this->getServer()->getPluginManager()->callEvent($ev);
         if ($ev->isCancelled()) {
             $ev->getProjectile()->kill();
         } else {
             $ev->getProjectile()->setMotion($ev->getProjectile()->getMotion()->multiply($ev->getForce()));
             if ($ev->getProjectile() instanceof Projectile) {
                 $this->getServer()->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($ev->getProjectile()));
                 if ($projectileEv->isCancelled()) {
                     $ev->getProjectile()->kill();
                 } else {
                     $this->object_hash[spl_object_hash($ev->getProjectile())] = 1;
                     $ev->getProjectile()->spawnToAll();
                 }
             } else {
                 $this->object_hash[spl_object_hash($ev->getProjectile())] = 1;
                 $ev->getProjectile()->spawnToAll();
             }
         }
     }
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:26,代碼來源:burstMode.php

示例2: launch

 public function launch(Player $player)
 {
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $player->x), new Double("", $player->y + $player->getEyeHeight()), new Double("", $player->z)]), "Motion" => new Enum("Motion", [new Double("", -sin($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)), new Double("", -sin($player->pitch / 180 * M_PI)), new Double("", cos($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI))]), "Rotation" => new Enum("Rotation", [new Float("", $player->yaw), new Float("", $player->pitch)]), "Data" => new Byte("Data", $this->getDamage())]);
     $f = $this->f;
     $launched = Entity::createEntity($this->getEntityName(), $player->chunk, $nbt, $player);
     $launched->setMotion($launched->getMotion()->multiply($f));
     if ($launched instanceof Projectile) {
         $player->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($launched));
         if ($projectileEv->isCancelled()) {
             $launched->kill();
         } else {
             $launched->spawnToAll();
             $player->level->addSound(new LaunchSound($player), $player->getViewers());
         }
     } else {
         $launched->spawnToAll();
     }
     return true;
 }
開發者ID:SuperAdam47,項目名稱:ClearSky,代碼行數:19,代碼來源:Launchable.php

示例3: launch

 public function launch(Player $player)
 {
     $dir = $player->getDirectionVector();
     $frontPos = $player->add($dir->multiply(1.1));
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $frontPos->x), new Double("", $frontPos->y + $player->getEyeHeight()), new Double("", $frontPos->z)]), "Motion" => new Enum("Motion", [new Double("", $dir->x), new Double("", $dir->y), new Double("", $dir->z)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)])]);
     $f = $this->f;
     $launched = Entity::createEntity($this->getEntityName(), $player->chunk, $nbt);
     $launched->setMotion($launched->getMotion()->multiply($f));
     if ($launched instanceof Projectile) {
         $player->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($launched));
         if ($projectileEv->isCancelled()) {
             $launched->kill();
         } else {
             $launched->spawnToAll();
             $player->level->addSound(new LaunchSound($player), $player->getViewers());
         }
     } else {
         $launched->spawnToAll();
     }
 }
開發者ID:kiyoshi-kurosaki,項目名稱:ClearSky,代碼行數:20,代碼來源:Launchable.php

示例4: fire

 private function fire(Player $c, $fuse, $speed)
 {
     $pos = $c->getPosition();
     $pos->y += $c->getEyeHeight();
     $dir = $c->getDirectionVector();
     $dir->x = $dir->x * $speed;
     $dir->y = $dir->y * $speed;
     $dir->z = $dir->z * $speed;
     $this->scorchit($pos, $dir, $fuse);
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:10,代碼來源:Main.php

示例5: shootArrow

 /**
  *
  * @param Player $player        	
  * @param Position $fromPos        	
  */
 public static function shootArrow(Player $player, Position $fromPos)
 {
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $fromPos->x), new Double("", $fromPos->y + $player->getEyeHeight()), new Double("", $fromPos->z)]), "Motion" => new Enum("Motion", [new Double("", -\sin($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI)), new Double("", -\sin($player->pitch / 180 * M_PI)), new Double("", \cos($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI))]), "Rotation" => new Enum("Rotation", [new Float("", $player->yaw), new Float("", $player->pitch)])]);
     $diff = 3;
     $p = $diff / 20;
     $f = \min(($p * 2 + $p * 2) / 3, 1) * 2;
     $ev = new EntityShootBowEvent($player, Item::get(Item::BOW), Entity::createEntity("Arrow", $player->chunk, $nbt, $player, $f == 2 ? \true : \false), $f);
     $ev->getProjectile()->spawnToAll();
     $player->level->addSound(new LaunchSound($player), $player->getViewers());
 }
開發者ID:robozeri,項目名稱:SG,代碼行數:15,代碼來源:PlayerHelper.php

示例6: isInsidePortal

 public function isInsidePortal(Player $player)
 {
     $block = $player->getLevel()->getBlock($player->temporalVector->setComponents(Math::floorFloat($player->x), Math::floorFloat($y = $player->y + $player->getEyeHeight()), Math::floorFloat($player->z)));
     return $block->getId() == 90;
 }
開發者ID:JiangsNetworkAlpha,項目名稱:JiangsNeather,代碼行數:5,代碼來源:NetherWorld.php

示例7: touch

 public function touch(Player $damager, Player $entity)
 {
     $damagerGameId = $this->players[$damager->getName()];
     $entityGameId = $this->players[$entity->getName()];
     if ($damagerGameId === $entityGameId && $damagerGameId !== "NONE") {
         $returnVal = $this->games[$damagerGameId]->touch($damager->getName(), $entity->getName());
         switch ($returnVal) {
             case GameManager::RETURNTYPE_TOUCH_ALREADY_TOUCED_FAILED:
                 $damager->sendMessage(TextFormat::RED . $this->getTranslation("TOUCH_ALREADY_TOUCHED"));
                 break;
             case GameManager::RETURNTYPE_TOUCH_IN_PREPARATION_OR_REST_FAILED:
                 $damager->sendMessage(TextFormat::RED . $this->getTranslation("PREPARATION_OR_REST"));
                 break;
             case GameManager::RETURNTYPE_TOUCH_SUCCEED:
                 $this->notifyTipForPlayers($damagerGameId, TextFormat::DARK_PURPLE . $this->getTranslation("TOUCH_MESSAGE", $damager->getName(), $entity->getName()));
                 $this->notifyForPlayers($damagerGameId, TextFormat::DARK_PURPLE . $this->getTranslation("TOUCH_MESSAGE", $damager->getName(), $entity->getName()));
                 $this->createTouchEffect($entity->getLocation(), $entity->getEyeHeight(), $damager->getLocation(), $damager->getEyeHeight());
                 break;
         }
         return $returnVal;
     }
     return false;
 }
開發者ID:EpicArtz08999,項目名稱:ZombieGame,代碼行數:23,代碼來源:GameGenius.php

示例8: __construct

 public function __construct(Player $player, Item $item)
 {
     parent::__construct($player->getLevel()->getChunk($player->x >> 4, $player->z >> 4), new Compound("", ["Pos" => new Enum("Pos", [new Double("", $player->x), new Double("", $player->y + $player->getEyeHeight()), new Double("", $player->z)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)])]));
     $this->item = $item->getID() == 0 ? Item::get(1000, 0, 0) : $item;
     $this->player = $player;
     $this->yaw = $player->getYaw();
     $this->pitch = $player->getPitch();
     parent::spawnToAll();
 }
開發者ID:Skull3x,項目名稱:MineBlock,代碼行數:9,代碼來源:Fishing.php


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