当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::getPitch方法代码示例

本文整理汇总了PHP中pocketmine\Player::getPitch方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getPitch方法的具体用法?PHP Player::getPitch怎么用?PHP Player::getPitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\Player的用法示例。


在下文中一共展示了Player::getPitch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($player instanceof Player) {
         $pitch = $player->getPitch();
         if (abs($pitch) >= 45) {
             if ($pitch < 0) {
                 $f = 0;
             } else {
                 $f = 1;
             }
         } else {
             $f = $player->getDirection() + 2;
         }
     } else {
         $f = 0;
     }
     $faces = [0 => 0, 1 => 1, 2 => 4, 3 => 2, 4 => 5, 5 => 3];
     $this->meta = $faces[$f];
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::DROPPER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     Tile::createTile(Tile::DROPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:32,代码来源:Dropper.php

示例2: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($player instanceof Player) {
         $pitch = $player->getPitch();
         if (abs($pitch) >= 45) {
             if ($pitch < 0) {
                 $f = 0;
             } else {
                 $f = 1;
             }
         } else {
             $f = $player->getDirection() + 2;
         }
     } else {
         $f = 0;
     }
     $faces = [0 => 0, 1 => 1, 2 => 5, 3 => 3, 4 => 4, 5 => 2];
     $this->meta = $faces[$f];
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new StringTag("id", Tile::PISTON), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z), new IntTag("blockData", 0), new IntTag("blockId", Item::PISTON_HEAD), new ByteTag("extending", 0), new IntTag("facing", $faces[$f]), new FloatTag("progress", 0.0)]);
     $tile = Tile::createTile("Piston", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:23,代码来源:Piston.php

示例3: stdPlayerVars

 /**
  * Basic player specific variable definitions
  * @param Player $player - reference to pocketmine Player
  * @param array &$vars - receives variable defintions
  */
 public function stdPlayerVars(Player $player, array &$vars)
 {
     foreach (["{player}" => $player->getName(), "{displayName}" => $player->getDisplayName(), "{world}" => $player->getLevel()->getName(), "{x}" => (int) $player->getX(), "{y}" => (int) $player->getY(), "{z}" => (int) $player->getZ(), "{yaw}" => (int) $player->getYaw(), "{pitch}" => (int) $player->getPitch(), "{bearing}" => self::bearing($player->getYaw())] as $a => $b) {
         $vars[$a] = $b;
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:11,代码来源:ExpandVars.php

示例4: sendMovePlayerPacket

 /**
  * @param Player $player
  * @return bool|int
  */
 public static function sendMovePlayerPacket(Player $player)
 {
     $packet = new MovePlayerPacket();
     $packet->eid = 0;
     $packet->x = $player->getX();
     $packet->y = $player->getY();
     $packet->z = $player->getZ();
     $packet->yaw = $player->getYaw();
     $packet->bodyYaw = $player->getYaw();
     $packet->pitch = $player->getPitch();
     $packet->onGround = false;
     return $player->dataPacket($packet);
 }
开发者ID:Artide,项目名称:Cameraman,代码行数:17,代码来源:Cameraman.php

示例5: setLobby

 public function setLobby($arena, Player $p)
 {
     $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
     $config->setNested("Spawn.Lobby.Welt", $p->getLevel()->getName());
     $config->setNested("Spawn.Lobby.X", $p->getX());
     $config->setNested("Spawn.Lobby.Y", $p->getY());
     $config->setNested("Spawn.Lobby.Z", $p->getZ());
     $config->setNested("Spawn.Lobby.Yaw", $p->getYaw());
     $config->setNested("Spawn.Lobby.Pitch", $p->getPitch());
     $config->save();
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:11,代码来源:Bedwars.php

示例6: teleportPlayer

 public function teleportPlayer(Player $player, Position $pos)
 {
     $player->teleport($pos, $player->getYaw(), $player->getPitch());
     $player->sendMessage("Teleported!");
 }
开发者ID:xHFx,项目名称:TpaFriends,代码行数:5,代码来源:main.php

示例7: __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::getPitch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。