Location
extends Position
in package
Table of Contents
- $pitch : float
- $world : World|null
- $x : float|int
- $y : float|int
- $yaw : float
- $z : float|int
- __construct() : mixed
- __toString() : mixed
- abs() : Vector3
- add() : Vector3
- addVector() : Vector3
- asLocation() : Location
- Return a Location instance
- asPosition() : Position
- Return a Position instance
- asVector3() : Vector3
- Return a Vector3 instance
- ceil() : Vector3
- cross() : Vector3
- distance() : float
- distanceSquared() : float
- divide() : Vector3
- dot() : float
- down() : Vector3
- east() : Vector3
- equals() : bool
- floor() : Vector3
- fromObject() : Location
- getFloorX() : int
- getFloorY() : int
- getFloorZ() : int
- getIntermediateWithXValue() : Vector3|null
- Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- getIntermediateWithYValue() : Vector3|null
- Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- getIntermediateWithZValue() : Vector3|null
- Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
- getPitch() : float
- getSide() : Vector3
- getWorld() : World
- Returns the position's world if valid. Throws an error if the world is unexpectedly invalid.
- getX() : float|int
- getY() : float|int
- getYaw() : float
- getZ() : float|int
- isValid() : bool
- Checks if this object has a valid reference to a loaded world
- length() : float
- lengthSquared() : float
- maxComponents() : Vector3
- Returns a new Vector3 taking the maximum of each component in the input vectors.
- maxPlainDistance() : float
- minComponents() : Vector3
- Returns a new Vector3 taking the minimum of each component in the input vectors.
- multiply() : Vector3
- normalize() : Vector3
- north() : Vector3
- round() : Vector3
- sides() : Generator|array<string|int, Vector3>
- Yields vectors stepped out from this one in all directions.
- sidesAroundAxis() : Generator|array<string|int, Vector3>
- Yields vectors stepped out from this one in directions except those on the given axis.
- sidesArray() : array<string|int, Vector3>
- Same as sides() but returns a pre-populated array instead of Generator.
- south() : Vector3
- subtract() : Vector3
- subtractVector() : Vector3
- sum() : Vector3
- up() : Vector3
- west() : Vector3
- withComponents() : Vector3
- Returns a Vector3 with the provided components. If any of the components are null, the values from this Vector3 will be filled in instead.
- zero() : Vector3
Properties
$pitch
public
float
$pitch
$world
public
World|null
$world
= null
$x
public
float|int
$x
$y
public
float|int
$y
$yaw
public
float
$yaw
$z
public
float|int
$z
Methods
__construct()
public
__construct(float $x, float $y, float $z, World|null $world, float $yaw, float $pitch) : mixed
Parameters
- $x : float
- $y : float
- $z : float
- $world : World|null
- $yaw : float
- $pitch : float
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —abs()
public
abs() : Vector3
Return values
Vector3 —add()
public
add(float|int $x, float|int $y, float|int $z) : Vector3
Parameters
- $x : float|int
- $y : float|int
- $z : float|int
Return values
Vector3 —addVector()
public
addVector(Vector3 $v) : Vector3
Parameters
- $v : Vector3
Return values
Vector3 —asLocation()
Return a Location instance
public
asLocation() : Location
Return values
Location —asPosition()
Return a Position instance
public
asPosition() : Position
Return values
Position —asVector3()
Return a Vector3 instance
public
asVector3() : Vector3
Return values
Vector3 —ceil()
public
ceil() : Vector3
Return values
Vector3 —cross()
public
cross(Vector3 $v) : Vector3
Parameters
- $v : Vector3
Return values
Vector3 —distance()
public
distance(Vector3 $pos) : float
Parameters
- $pos : Vector3
Return values
float —distanceSquared()
public
distanceSquared(Vector3 $pos) : float
Parameters
- $pos : Vector3
Return values
float —divide()
public
divide(float $number) : Vector3
Parameters
- $number : float
Return values
Vector3 —dot()
public
dot(Vector3 $v) : float
Parameters
- $v : Vector3
Return values
float —down()
public
down([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —east()
public
east([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —equals()
public
equals(Vector3 $v) : bool
Parameters
- $v : Vector3
Return values
bool —floor()
public
floor() : Vector3
Return values
Vector3 —fromObject()
public
static fromObject(Vector3 $pos, World|null $world[, float $yaw = 0.0 ][, float $pitch = 0.0 ]) : Location
Parameters
Return values
Location —getFloorX()
public
getFloorX() : int
Return values
int —getFloorY()
public
getFloorY() : int
Return values
int —getFloorZ()
public
getFloorZ() : int
Return values
int —getIntermediateWithXValue()
Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
public
getIntermediateWithXValue(Vector3 $v, float $x) : Vector3|null
Parameters
- $v : Vector3
- $x : float
Return values
Vector3|null —getIntermediateWithYValue()
Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
public
getIntermediateWithYValue(Vector3 $v, float $y) : Vector3|null
Parameters
- $v : Vector3
- $y : float
Return values
Vector3|null —getIntermediateWithZValue()
Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
public
getIntermediateWithZValue(Vector3 $v, float $z) : Vector3|null
Parameters
- $v : Vector3
- $z : float
Return values
Vector3|null —getPitch()
public
getPitch() : float
Return values
float —getSide()
public
getSide(int $side[, int $step = 1 ]) : Vector3
Parameters
- $side : int
- $step : int = 1
Return values
Vector3 —getWorld()
Returns the position's world if valid. Throws an error if the world is unexpectedly invalid.
public
getWorld() : World
Tags
Return values
World —getX()
public
getX() : float|int
Return values
float|int —getY()
public
getY() : float|int
Return values
float|int —getYaw()
public
getYaw() : float
Return values
float —getZ()
public
getZ() : float|int
Return values
float|int —isValid()
Checks if this object has a valid reference to a loaded world
public
isValid() : bool
Return values
bool —length()
public
length() : float
Return values
float —lengthSquared()
public
lengthSquared() : float
Return values
float —maxComponents()
Returns a new Vector3 taking the maximum of each component in the input vectors.
public
static maxComponents(Vector3 $vector, Vector3 ...$vectors) : Vector3
Parameters
Return values
Vector3 —maxPlainDistance()
public
maxPlainDistance(Vector3|Vector2|float $x[, float $z = 0 ]) : float
Parameters
Return values
float —minComponents()
Returns a new Vector3 taking the minimum of each component in the input vectors.
public
static minComponents(Vector3 $vector, Vector3 ...$vectors) : Vector3
Parameters
Return values
Vector3 —multiply()
public
multiply(float $number) : Vector3
Parameters
- $number : float
Return values
Vector3 —normalize()
public
normalize() : Vector3
Return values
Vector3 —north()
public
north([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —round()
public
round([int $precision = 0 ][, int $mode = PHP_ROUND_HALF_UP ]) : Vector3
Parameters
- $precision : int = 0
- $mode : int = PHP_ROUND_HALF_UP
Return values
Vector3 —sides()
Yields vectors stepped out from this one in all directions.
public
sides([int $step = 1 ]) : Generator|array<string|int, Vector3>
Parameters
- $step : int = 1
-
Distance in each direction to shift the vector
Tags
Return values
Generator|array<string|int, Vector3> —sidesAroundAxis()
Yields vectors stepped out from this one in directions except those on the given axis.
public
sidesAroundAxis(int $axis[, int $step = 1 ]) : Generator|array<string|int, Vector3>
Parameters
- $axis : int
-
Facing directions on this axis will be excluded
- $step : int = 1
Tags
Return values
Generator|array<string|int, Vector3> —sidesArray()
Same as sides() but returns a pre-populated array instead of Generator.
public
sidesArray([bool $keys = false ][, int $step = 1 ]) : array<string|int, Vector3>
Parameters
- $keys : bool = false
- $step : int = 1
Return values
array<string|int, Vector3> —south()
public
south([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —subtract()
public
subtract(float|int $x, float|int $y, float|int $z) : Vector3
Parameters
- $x : float|int
- $y : float|int
- $z : float|int
Return values
Vector3 —subtractVector()
public
subtractVector(Vector3 $v) : Vector3
Parameters
- $v : Vector3
Return values
Vector3 —sum()
public
static sum(Vector3 ...$vector3s) : Vector3
Parameters
- $vector3s : Vector3
Return values
Vector3 —up()
public
up([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —west()
public
west([int $step = 1 ]) : Vector3
Parameters
- $step : int = 1
Return values
Vector3 —withComponents()
Returns a Vector3 with the provided components. If any of the components are null, the values from this Vector3 will be filled in instead.
public
withComponents(float|int|null $x, float|int|null $y, float|int|null $z) : Vector3
If no components are overridden (all components are null), the original vector will be returned unchanged.
Parameters
- $x : float|int|null
- $y : float|int|null
- $z : float|int|null
Return values
Vector3 —zero()
public
static zero() : Vector3