本文整理汇总了PHP中pocketmine\level\Position::getFloorX方法的典型用法代码示例。如果您正苦于以下问题:PHP Position::getFloorX方法的具体用法?PHP Position::getFloorX怎么用?PHP Position::getFloorX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\Position
的用法示例。
在下文中一共展示了Position::getFloorX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPosList
public function getPosList()
{
$out = [];
switch ($this->axis) {
case self::X:
for ($i = 0; $i < $this->height; $i++) {
$x = $this->base->getFloorX() + $i;
$centre = new Vector3($x, $this->base->getFloorY(), $this->base->getFloorZ());
for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
$v = new Vector3($x, $y, $z);
if ($centre->distance($v) <= $this->radius) {
$out[] = $this->base->getLevel();
}
}
}
}
break;
case self::Y:
for ($i = 0; $i < $this->height; $i++) {
$y = $this->base->getFloorY() + $i;
$centre = new Vector3($this->base->getFloorX(), $y, $this->base->getFloorZ());
for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorX() + $this->radius; $x++) {
for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
$v = new Position($x, $y, $z, $this->base->getLevel());
if ($centre->distance($v) <= $this->radius) {
$out[] = $v;
}
}
}
}
break;
case self::Z:
for ($i = 0; $i < $this->height; $i++) {
$z = $this->base->getFloorZ() + $i;
$centre = new Vector3($this->base->getFloorX(), $this->base->getFloorY(), $z);
for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorY() + $this->radius; $x++) {
for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
$v = new Position($x, $y, $z, $this->base->getLevel());
if ($centre->distance($v) <= $this->radius) {
$out[] = $v;
}
}
}
}
break;
}
return $out;
}
示例2: getLocByBlock
public function getLocByBlock(Position $block)
{
return $block->getFloorX() . ";" . $block->getFloorY() . ";" . $block->getFloorZ() . ";" . $block->getLevel()->getFolderName();
}
示例3: encodeLoc
public static function encodeLoc(Position $location)
{
return $location->getFloorX() . ";" . $location->getFloorY() . ";" . $location->getFloorZ() . ";" . $location->getLevel()->getFolderName();
}