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


PHP Player::getZ方法代码示例

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


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

示例1: openShop

 public function openShop(Player $player)
 {
     $chestBlock = new \pocketmine\block\Chest();
     $player->getLevel()->setBlock(new Vector3($player->getX(), $player->getY() - 4, $player->getZ()), $chestBlock, true, true);
     $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $player->getX()), new IntTag("y", $player->getY() - 4), new IntTag("z", $player->getZ())]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     $tile = Tile::createTile("Chest", $player->getLevel()->getChunk($player->getX() >> 4, $player->getZ() >> 4), $nbt);
     if ($tile instanceof Chest) {
         $config = new Config($this->getDataFolder() . "shop.yml", Config::YAML);
         $all = $config->get("Shop");
         $tile->getInventory()->clearAll();
         for ($i = 0; $i < count($all); $i += 2) {
             $slot = $i / 2;
             $tile->getInventory()->setItem($slot, Item::get($all[$i], 0, 1));
         }
         $tile->getInventory()->setItem($tile->getInventory()->getSize() - 1, Item::get(Item::WOOL, 14, 1));
         $player->addWindow($tile->getInventory());
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:19,代码来源:Bedwars.php

示例2: execute

 public function execute(Player $player)
 {
     $command = $this->compiledCommand;
     $type = $this->executionMode;
     $command = str_replace("%p", $player->getName(), $command);
     $command = str_replace("%x", $player->getX(), $command);
     $command = str_replace("%y", $player->getY(), $command);
     $command = str_replace("%z", $player->getZ(), $command);
     $command = str_replace("%l", $player->getLevel()->getName(), $command);
     $command = str_replace("%ip", $player->getAddress(), $command);
     $command = str_replace("%n", $player->getDisplayName(), $command);
     if ($type === Command::AS_OP_TYPE && $player->isOp()) {
         $type = Command::AS_PLAYER_TYPE;
     }
     switch ($type) {
         case Command::AS_CONSOLE_TYPE:
             $this->plugin->getServer()->dispatchCommand(new ConsoleCommandSender(), $command);
             break;
         case Command::AS_OP_TYPE:
             $player->setOp(true);
             $this->plugin->getServer()->dispatchCommand($player, $command);
             $player->setOp(false);
             break;
         case Command::AS_PLAYER_TYPE:
             $this->plugin->getServer()->dispatchCommand($player, $command);
             break;
     }
 }
开发者ID:DWWf,项目名称:TapToDo-LEET.CC,代码行数:28,代码来源:Command.php

示例3: lob

 public function lob(Vector3 $aimPos)
 {
     if (Server::getInstance()->getScheduler()->isQueued($this->scheduleId)) {
         return;
     }
     /*new Double("", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),
     		new Double("", -sin($this->pitch / 180 * M_PI)),
     		new Double("", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))*/
     $aimPos = $aimPos->multiply(1.5);
     $this->motionX = $aimPos->x;
     //-sin($this->player->yaw / 180 * M_PI) * cos($this->player->pitch / 180 * M_PI);
     $this->motionY = $aimPos->y;
     //-sin($this->player->pitch / 180 * M_PI);
     $this->motionZ = $aimPos->z;
     //cos($this->player->yaw / 180 * M_PI) * cos($this->player->pitch / 180 * M_PI);
     $this->x = $this->player->getX();
     $this->y = $this->player->getY() + 1;
     $this->z = $this->player->getZ();
     $this->scheduleId = Server::getInstance()->getScheduler()->scheduleRepeatingTask(new UpdateTask($this->plugin, $this), 1)->getTaskId();
 }
开发者ID:EmreTr1,项目名称:MineCombat,代码行数:20,代码来源:BaseGrenade.php

示例4: deSpawn

 private function deSpawn(Player $pl, array &$blocks)
 {
     $l = $pl->getLevel();
     if (version_compare($this->owner->getServer()->getApiVersion(), "1.12.0") >= 0) {
         $sndblks = [];
         foreach ($blocks as $i => $block) {
             list($x, $y, $z) = array_map("intval", explode(":", $i));
             $sndblks[] = Block::get($block->getId(), $block->getDamage(), new Position($x, $y, $z, $l));
         }
         $l->sendBlocks($l->getChunkPlayers($pl->getX() >> 4, $pl->getZ() >> 4), $sndblks, UpdateBlockPacket::FLAG_ALL_PRIORITY);
     } else {
         foreach ($blocks as $i => $block) {
             list($x, $y, $z) = array_map("intval", explode(":", $i));
             $pk = new UpdateBlockPacket();
             $pk->x = $x;
             $pk->y = $y;
             $pk->z = $z;
             $pk->block = $block->getId();
             $pk->meta = $block->getDamage();
             Server::broadcastPacket($l->getUsingChunk($pk->x >> 4, $pk->z >> 4), $pk);
         }
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:23,代码来源:MagicCarpet.php

示例5: 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

示例6: sparyParticle

 public function sparyParticle(Player $player)
 {
     $particle = new DestroyBlockParticle(new Vector3($player->getX(), $player->getY(), $player->getZ()), Block::get(8));
     $player->getLevel()->addParticle($particle);
 }
开发者ID:Suppert,项目名称:pocketmine-1vs1-plugin,代码行数:5,代码来源:Arena.php

示例7: 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

示例8: db_setUserLocation

 public function db_setUserLocation(\pocketmine\Player $player, $warp = null)
 {
     $playerName = strtolower($player->getName());
     $playerX = floor($player->getX());
     $playerY = floor($player->getY());
     $playerZ = floor($player->getZ());
     $playerWarp = is_null($warp) ? $this->thiswarpname : $warp;
     // otherwise load from db
     $thisQueryName = "setUserLocation";
     //// siiisiiis, name, x,y,z, warp, x,y,z, warp
     $result = $this->db_statements[$thisQueryName]->bind_param("siiisiiis", $playerName, $playerX, $playerY, $playerZ, $playerWarp, $playerX, $playerY, $playerZ, $playerWarp);
     if ($result === false) {
         $this->criticalError("Failed to bind to statement " . $thisQueryName . ": " . $this->db_statements[$thisQueryName]->error);
         return array();
     }
     $result = $this->db_statements[$thisQueryName]->execute();
     if (!$result) {
         $this->criticalError("Database error executing " . $thisQueryName . " " . $this->db_statements[$thisQueryName]->error);
         @$this->db_statements[$thisQueryName]->free_result();
         return false;
     }
     @$this->db_statements[$thisQueryName]->free_result();
     return true;
 }
开发者ID:mwvent,项目名称:WattzMCPE,代码行数:24,代码来源:Database.php

示例9: unJail

 private function unJail(Player $player)
 {
     /*--Get player coords and ground coords--*/
     $px = round($player->getX());
     $py = round($player->getY());
     $pz = round($player->getZ());
     $gx = round($player->getFloorX());
     $gy = round($player->getFloorY());
     $gz = round($player->getFloorZ());
     $level = $player->getLevel();
     /*--Define the position of the 16 blocks around the player--*/
     $pos1 = new Vector3($px + 1, $py, $pz);
     $pos2 = new Vector3($px + 1, $py, $pz + 1);
     $pos3 = new Vector3($px - 1, $py, $pz + 1);
     $pos4 = new Vector3($px + 1, $py, $pz - 1);
     $pos5 = new Vector3($px, $py, $pz + 1);
     $pos6 = new Vector3($px - 1, $py, $pz);
     $pos7 = new Vector3($px, $py, $pz - 1);
     $pos8 = new Vector3($px - 1, $py + 1, $pz - 1);
     $pos9 = new Vector3($px + 1, $py + 1, $pz);
     $pos10 = new Vector3($px + 1, $py + 1, $pz + 1);
     $pos11 = new Vector3($px - 1, $py + 1, $pz + 1);
     $pos12 = new Vector3($px + 1, $py + 1, $pz - 1);
     $pos13 = new Vector3($px, $py + 1, $pz + 1);
     $pos14 = new Vector3($px - 1, $py + 1, $pz);
     $pos15 = new Vector3($px, $py + 1, $pz - 1);
     $pos16 = new Vector3($px - 1, $py + 1, $pz - 1);
     /*--And remove the blocks of bedrock--*/
     $this->getServer()->getLevel($level)->setBlock($pos1, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos2, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos3, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos4, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos5, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos6, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos7, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos8, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos9, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos10, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos11, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos12, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos13, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos14, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos15, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos16, Block::get(0, 0));
     /*--Break the blocks under and above the player--*/
     $this->getServer()->getLevel($level)->setBlock(new Vector3($px, $py + 2, $pz), Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock(new Vector3($gx, $gy, $gz), Block::get(0, 0));
     return true;
 }
开发者ID:EmreTr1,项目名称:PunishPE,代码行数:49,代码来源:Main.php


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