当前位置: 首页>>代码示例>>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;未经允许,请勿转载。