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


PHP Position::getZ方法代码示例

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


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

示例1: dropExpOrb__api200

 public static function dropExpOrb__api200(Position $source, $exp = 1, Vector3 $motion = \null, $delay = 40)
 {
     $motion = $motion === \null ? new Vector3(\lcg_value() * 0.2 - 0.1, 0.4, \lcg_value() * 0.2 - 0.1) : $motion;
     $entity = Entity::createEntity("ExperienceOrb", $source->getLevel()->getChunk($source->getX() >> 4, $source->getZ() >> 4, \true), new \pocketmine\nbt\tag\CompoundTag("", ["Pos" => new \pocketmine\nbt\tag\ListTag("Pos", [new \pocketmine\nbt\tag\DoubleTag("", $source->getX()), new \pocketmine\nbt\tag\DoubleTag("", $source->getY()), new \pocketmine\nbt\tag\DoubleTag("", $source->getZ())]), "Motion" => new \pocketmine\nbt\tag\ListTag("Motion", [new \pocketmine\nbt\tag\DoubleTag("", $motion->x), new \pocketmine\nbt\tag\DoubleTag("", $motion->y), new \pocketmine\nbt\tag\DoubleTag("", $motion->z)]), "Rotation" => new \pocketmine\nbt\tag\ListTag("Rotation", [new \pocketmine\nbt\tag\FloatTag("", \lcg_value() * 360), new \pocketmine\nbt\tag\FloatTag("", 0)]), "Health" => new \pocketmine\nbt\tag\ShortTag("Health", 20), "PickupDelay" => new \pocketmine\nbt\tag\ShortTag("PickupDelay", $delay)]));
     if ($entity instanceof ExperienceOrb) {
         $entity->setExp($exp);
     }
     $entity->spawnToAll();
 }
开发者ID:Gumbrat,项目名称:PlayHarder,代码行数:9,代码来源:ExperienceSystem.php

示例2: setHome

 public function setHome(IPlayer $player, Position $pos)
 {
     $n = strtolower($player->getName());
     $l = "l-" . strtolower($pos->getLevel()->getName());
     $this->homes[$l][$n] = [$pos->getX(), $pos->getY(), $pos->getZ()];
     $this->saveHomes();
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:7,代码来源:CmdHomes.php

示例3: checkMove

 public function checkMove(Position $p)
 {
     if (!$this->cfg["mines"]) {
         return false;
     }
     $bl = [];
     for ($i = 1; $i < 4; $i++) {
         $bl[$i] = $p->getLevel()->getBlockIdAt($p->getX(), $p->getY() - $i, $p->getZ());
     }
     for ($i = 1; $i < 3; $i++) {
         if ($bl[$i] == $this->mine["block1"]) {
             if (isset($this->mine["block2"]) && $this->mine["block2"] != $bl[$i + 1]) {
                 continue;
             }
             // explode!
             $p->getLevel()->setBlockIdAt($p->getX(), $p->getY() - $i, $p->getZ(), 0);
             $this->scorchit(new Position($p->getX() + 0.5, $p->getY() - $i + 0.5, $p->getZ() + 0.5, $p->getLevel()), new Vector3(0, 0, 0), 1);
             return false;
         }
     }
     return false;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:22,代码来源:Main.php

示例4: tpNearBy

 /**
  * Teleport a player near a location
  * @param Player $player - player to be teleported
  * @param Position $target - location to teleport nearby
  * @param int $rand - how far to randomize positions
  * @param int|null $dist - if not null it will make sure that new location is upto $dist
  * @return bool - true on success, false on failure
  */
 public static function tpNearBy(Player $player, Position $target, $rand = 3, $dist = null)
 {
     $mv = new Vector3($target->getX() + mt_rand(-$rand, $rand), $target->getY(), $target->getZ() + mt_rand(-$rand, $rand));
     $pos = $target->getLevel()->getSafeSpawn($mv);
     if ($dist !== null) {
         $newdist = $pos->distance($target);
         if ($newdist > $dist) {
             return false;
         }
         // Will not get close enough!
     }
     $player->teleport($pos);
     return true;
 }
开发者ID:edwinyoo44,项目名称:pocketmine-plugins,代码行数:22,代码来源:TPUtils.php

示例5: __construct

 public function __construct(Position $a, Vector3 $b)
 {
     $this->raw0 = $a;
     if (!$b instanceof Position) {
         $b = new Position($b->getX(), $b->getY(), $b->getZ(), $a->getLevel());
     }
     $this->raw1 = $b;
     if ($a->getLevel()->getName() !== $b->getLevel()->getName()) {
         trigger_error("Positions of different levels (\"" . $a->getLevel()->getName() . "\" and \"" . $b->getLevel()->getName() . "\" passed to constructor of " . get_class($this), E_USER_WARNING);
     }
     $this->bake();
     parent::__construct();
     // call this at the last because it has to bake before acquiring
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:14,代码来源:CuboidSpace.php

示例6: explode

 public function explode(Position $pos)
 {
     $aabb = new AxisAlignedBB($pos->getX() - self::RANGE, $pos->getY() - self::RANGE, $pos->getZ() - self::RANGE, $pos->getX() + self::RANGE, $pos->getY() + self::RANGE, $pos->getZ() + self::RANGE);
     $nearbyEntities = $this->getPlayer()->getLevel()->getNearbyEntities($aabb, null);
     $pk = new ExplodePacket();
     $pk->x = $pos->x;
     $pk->y = $pos->y;
     $pk->z = $pos->z;
     $pk->radius = 10;
     $pk->records = [new Vector3($pos->x, $pos->y, $pos->z)];
     Server::broadcastPacket($this->getPlayer()->getLevel()->getChunkPlayers($pos->x >> 4, $pos->z >> 4), $pk->setChannel(Network::CHANNEL_BLOCKS));
     foreach ($nearbyEntities as $entity) {
         if (!$entity instanceof Player) {
             continue;
         }
         if ($this->getPlugin()->isEnemy($this->getPlayer()->getName(), $entity->getName())) {
             $event = new EntityDamageByEntityEvent($this->getPlayer(), $entity, 16, 15);
             $entity->attack($event->getFinalDamage(), $event);
         }
     }
     for ($i = 0; $i < 100; $i++) {
         $this->getPlayer()->getLevel()->addParticle(new CriticalParticle(new Vector3($pos->x + mt_rand(-self::RANGE, self::RANGE), $pos->y + mt_rand(-self::RANGE, self::RANGE), $pos->z + mt_rand(-self::RANGE, self::RANGE))));
     }
 }
开发者ID:EmreTr1,项目名称:MineCombat,代码行数:24,代码来源:FragmentationGrenade.php

示例7: isInside

 public function isInside(Vector3 $v)
 {
     $out = true;
     switch ($this->axis) {
         case self::X:
             $out = ($out and $this->base->getX() <= $v->getX() and $v->getX() <= $this->base->getX() + $this->height);
             $out = ($out and $v->distance(new Vector3($v->getX(), $this->base->getY(), $this->base->getZ())) <= $this->radius);
             break;
         case self::Y:
             $out = ($out and $this->base->getY() <= $v->getY() and $v->getY() <= $this->base->getY() + $this->height);
             $out = ($out and $v->distance(new Vector3($this->base->getX(), $v->getY(), $this->base->getZ())) <= $this->radius);
             break;
         case self::Z:
             $out = ($out and $this->base->getZ() <= $v->getZ() and $v->getZ() <= $this->base->getZ() + $this->height);
             $out = ($out and $v->distance(new Vector3($this->base->getX(), $this->base->getY(), $v->getZ())) <= $this->radius);
             break;
     }
     if ($v instanceof Position) {
         $out = ($out and $v->getLevel()->getName() === $this->base->getLevel()->getName());
     }
     return $out;
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:22,代码来源:CylinderSpace.php

示例8: getLocationByPosition

 public function getLocationByPosition(Position $pos)
 {
     return $pos->getLevel()->getFolderName() . ";" . $pos->getX() . ";" . $pos->getY() . ";" . $pos->getZ();
 }
开发者ID:HelloWorld017,项目名称:xChange,代码行数:4,代码来源:ExchangeItem.php

示例9: setSpawnPoint

 public function setSpawnPoint(Position $pos)
 {
     $this->plugin->warDB["spawn"]["red-team"]["pos"] = (int) $pos->getX() . "." . (int) $pos->getY() . "." . (int) $pos->getZ();
     $this->plugin->warDB["spawn"]["red-team"]["level"] = $pos->getLevel()->getName();
 }
开发者ID:organization,项目名称:MCFTWARS,代码行数:5,代码来源:redTeam.php

示例10: setLobby

 public function setLobby(Position $pos)
 {
     $this->plugin->warDB["spawn"]["lobby"]["pos"] = (int) $pos->getX() . "." . (int) $pos->getY() . "." . (int) $pos->getZ();
     $this->plugin->warDB["spawn"]["lobby"]["level"] = $pos->getLevel()->getName();
 }
开发者ID:organization,项目名称:MCFTWARS,代码行数:5,代码来源:war.php

示例11: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     if ($this->active == false and isset($this->players[$event->getPlayer()->getName()])) {
         $event->setCancelled();
     }
     if (isset($this->players[$event->getPlayer()->getName()])) {
         if ($event->getBlock()->getID() != $this->plugin->getConfig()->get("surface")) {
             $event->setCancelled();
         } else {
             if ($this->active == true) {
                 $block = $event->getBlock();
                 $event->setInstaBreak(true);
                 $block = new Position($block->getX(), $block->getY(), $block->getZ(), $block->getLevel());
                 $this->broken[] = $block;
             }
         }
     }
 }
开发者ID:Skull3x,项目名称:WonderCore,代码行数:18,代码来源:Arena.php

示例12: areaPosCast

 public function areaPosCast(Position $pos1, Position $pos2)
 {
     $startX = (int) $pos1->getX();
     $startZ = (int) $pos1->getZ();
     $endX = (int) $pos2->getX();
     $endZ = (int) $pos2->getZ();
     if ($startX > $endX) {
         $backup = $startX;
         $startX = $endX;
         $endX = $backup;
     }
     if ($startZ > $endZ) {
         $backup = $startZ;
         $startZ = $endZ;
         $endZ = $backup;
     }
     return [$startX, $endX, $startZ, $endZ];
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:18,代码来源:SimpleArea.php

示例13: writePosition

 protected function writePosition(Position $pos)
 {
     $this->buffer .= Bin::writeInt($pos->getX() >> 4);
     $this->buffer .= Bin::writeInt($pos->getZ() >> 4);
     $this->buffer .= Bin::writeByte(($pos->getX() & 0xf) << 4 & ($pos->getZ() & 0xf));
     $this->buffer .= Bin::writeByte(strlen($pos->getLevel()->getName()));
     $this->buffer .= $pos->getLevel()->getName();
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:PocketFactions,代码行数:8,代码来源:WriteDatabaseTask.php

示例14: fromObject

 /**
  * @param Position $pos
  * @return static
  */
 public static function fromObject(Position $pos)
 {
     return new self($pos->getX() >> 4, $pos->getZ() >> 4, $pos->getLevel());
     // don't refer to the object directly, else clone it
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:PocketFactions,代码行数:9,代码来源:Chunk.php

示例15: snowShoot

 public function snowShoot(Position $pos)
 {
     $player = Entity::Human;
     $nbt = new Compound("", [new Enum("Pos", [new Double("", $pos->getX()), new Double("", $pos->getY()), new Double("", $pos->getZ())]), new Enum("Motion", [new Double("", 0.0), new Double("", 1.0), new Double("", 0.0)])]);
     $snow = Entity::createEntity('Snowball', $pos->getLevel()->getChunk($pos->getX() >> 4, $pos->getY() >> 4, $pos->getZ() >> 4, $nbt));
     $snow->spawnToAll();
     $snow->canCollideWith($player);
     return $snow->getId();
 }
开发者ID:andrewnoelcasper,项目名称:Falcon-Spleef,代码行数:9,代码来源:index.php


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