|
| | __construct ($x=0, $y=0, $z=0, Level $level=null) |
| |
| | asPosition () |
| |
| | add ($x, $y=0, $z=0) |
| |
| | getLevel () |
| |
| | setLevel (Level $level=null) |
| |
| | isValid () |
| |
| | getSide ($side, $step=1) |
| |
| | __toString () |
| |
| | setComponents ($x, $y, $z) |
| |
| | fromObjectAdd (Vector3 $pos, $x, $y, $z) |
| |
| | __construct ($x=0, $y=0, $z=0) |
| |
| | getX () |
| |
| | getY () |
| |
| | getZ () |
| |
| | getFloorX () |
| |
| | getFloorY () |
| |
| | getFloorZ () |
| |
| | getRight () |
| |
| | getUp () |
| |
| | getForward () |
| |
| | getSouth () |
| |
| | getWest () |
| |
| | add ($x, $y=0, $z=0) |
| |
| | subtract ($x=0, $y=0, $z=0) |
| |
| | multiply ($number) |
| |
| | divide ($number) |
| |
| | ceil () |
| |
| | floor () |
| |
| | round () |
| |
| | abs () |
| |
| | getSide ($side, $step=1) |
| |
| | asVector3 () |
| |
| | distance (Vector3 $pos) |
| |
| | distanceSquared (Vector3 $pos) |
| |
| | maxPlainDistance ($x=0, $z=0) |
| |
| | length () |
| |
| | lengthSquared () |
| |
| | normalize () |
| |
| | dot (Vector3 $v) |
| |
| | cross (Vector3 $v) |
| |
| | equals (Vector3 $v) |
| |
| | getIntermediateWithXValue (Vector3 $v, $x) |
| |
| | getIntermediateWithYValue (Vector3 $v, $y) |
| |
| | getIntermediateWithZValue (Vector3 $v, $z) |
| |
| | setComponents ($x, $y, $z) |
| |
| | fromObjectAdd (Vector3 $pos, $x, $y, $z) |
| |
| | __toString () |
| |
◆ __construct()
| __construct |
( |
|
$x = 0, |
|
|
|
$y = 0, |
|
|
|
$z = 0, |
|
|
Level |
$level = null |
|
) |
| |
- Parameters
-
| int | $x | |
| int | $y | |
| int | $z | |
| Level | $level | |
◆ __toString()
- Returns
- string
141 return "Position(level=" . ($this->
isValid() ? $this->
getLevel()->getName() :
"null") .
",x=" . $this->x .
",y=" . $this->y .
",z=" . $this->z .
")";
◆ add()
| add |
( |
|
$x, |
|
|
|
$y = 0, |
|
|
|
$z = 0 |
|
) |
| |
- Parameters
-
| int | Vector3 | $x | |
| int | $y | |
| int | $z | |
- Returns
- Position
74 return new Position($this->x +
$x->x, $this->y +
$x->y, $this->z +
$x->z, $this->level);
76 return new Position($this->x +
$x, $this->y +
$y, $this->z +
$z, $this->level);
◆ asPosition()
Return a Position instance
- Returns
- Position
62 return new Position($this->x, $this->y, $this->z, $this->level);
◆ fromObject()
- Parameters
-
| Vector3 | $pos | |
| Level | null | $level | |
- Returns
- Position
53 return new Position($pos->x, $pos->y, $pos->z,
$level);
◆ fromObjectAdd()
| fromObjectAdd |
( |
Vector3 |
$pos, |
|
|
|
$x, |
|
|
|
$y, |
|
|
|
$z |
|
) |
| |
- Parameters
-
- Returns
- $this
167 if($pos instanceof Position){
168 $this->level = $pos->level;
170 parent::fromObjectAdd($pos,
$x,
$y,
$z);
◆ getLevel()
- Returns
- Level
84 if($this->level !== null and $this->level->isClosed()){
◆ getSide()
| getSide |
( |
|
$side, |
|
|
|
$step = 1 |
|
) |
| |
Returns a side Vector
- Parameters
-
- Returns
- Position
- Exceptions
-
131 throw new LevelException(
"Undefined Level reference");
◆ isValid()
Checks if this object has a valid reference to a loaded Level
- Returns
- bool
116 return $this->
getLevel() instanceof Level;
◆ setComponents()
| setComponents |
( |
|
$x, |
|
|
|
$y, |
|
|
|
$z |
|
) |
| |
◆ setLevel()
| setLevel |
( |
Level |
$level = null | ) |
|
Sets the target Level of the position.
- Parameters
-
- Returns
- $this
- Exceptions
-
103 throw new \InvalidArgumentException(
"Specified level has been unloaded and cannot be used");
◆ $level
The documentation for this class was generated from the following file:
- src/pocketmine/level/Position.php