PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\entity\Location Class Reference
+ Inheritance diagram for pocketmine\entity\Location:
+ Collaboration diagram for pocketmine\entity\Location:

Public Member Functions

 __construct (float $x, float $y, float $z, ?World $world, float $yaw, float $pitch)
 
 __toString ()
 
 abs ()
 
 add (float|int $x, float|int $y, float|int $z)
 
 addVector (Vector3 $v)
 
 asLocation ()
 
 asPosition ()
 
 asVector3 ()
 
 ceil ()
 
 cross (Vector3 $v)
 
 distance (Vector3 $pos)
 
 distanceSquared (Vector3 $pos)
 
 divide (float $number)
 
 dot (Vector3 $v)
 
 down (int $step=1)
 
 east (int $step=1)
 
 equals (Vector3 $v)
 
 floor ()
 
 getFloorX ()
 
 getFloorY ()
 
 getFloorZ ()
 
 getIntermediateWithXValue (Vector3 $v, float $x)
 
 getIntermediateWithYValue (Vector3 $v, float $y)
 
 getIntermediateWithZValue (Vector3 $v, float $z)
 
 getPitch ()
 
 getSide (int $side, int $step=1)
 
 getWorld ()
 
 getX ()
 
 getY ()
 
 getYaw ()
 
 getZ ()
 
 isValid ()
 
 length ()
 
 lengthSquared ()
 
 maxPlainDistance (Vector3|Vector2|float $x, float $z=0)
 
 multiply (float $number)
 
 normalize ()
 
 north (int $step=1)
 
 round (int $precision=0, int $mode=PHP_ROUND_HALF_UP)
 
 sides (int $step=1)
 
 sidesAroundAxis (int $axis, int $step=1)
 
 sidesArray (bool $keys=false, int $step=1)
 
 south (int $step=1)
 
 subtract (float|int $x, float|int $y, float|int $z)
 
 subtractVector (Vector3 $v)
 
 up (int $step=1)
 
 west (int $step=1)
 
 withComponents (float|int|null $x, float|int|null $y, float|int|null $z)
 

Static Public Member Functions

static fromObject (Vector3 $pos, ?World $world)
 
static fromObject (Vector3 $pos, ?World $world, float $yaw=0.0, float $pitch=0.0)
 
static maxComponents (Vector3 $vector, Vector3 ... $vectors)
 
static minComponents (Vector3 $vector, Vector3 ... $vectors)
 
static sum (Vector3 ... $vector3s)
 
static zero ()
 

Public Attributes

float $pitch
 
World $world = null
 
float $yaw
 

Detailed Description

Definition at line 30 of file Location.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\Location::__construct ( float  $x,
float  $y,
float  $z,
?World  $world,
float  $yaw,
float  $pitch 
)

Definition at line 35 of file Location.php.

Member Function Documentation

◆ __toString()

pocketmine\entity\Location::__toString ( )

Reimplemented from pocketmine\world\Position.

Definition at line 63 of file Location.php.

◆ abs()

pocketmine\math\Vector3::abs ( )
inherited

Definition at line 113 of file Vector3.php.

◆ add()

pocketmine\math\Vector3::add ( float|int  $x,
float|int  $y,
float|int  $z 
)
inherited

Definition at line 72 of file Vector3.php.

◆ addVector()

pocketmine\math\Vector3::addVector ( Vector3  $v)
inherited

Definition at line 76 of file Vector3.php.

◆ asLocation()

pocketmine\entity\Location::asLocation ( )

Return a Location instance

Definition at line 51 of file Location.php.

◆ asPosition()

pocketmine\world\Position::asPosition ( )
inherited

Return a Position instance

Definition at line 52 of file Position.php.

◆ asVector3()

pocketmine\math\Vector3::asVector3 ( )
inherited

Return a Vector3 instance

Definition at line 210 of file Vector3.php.

◆ ceil()

pocketmine\math\Vector3::ceil ( )
inherited

Definition at line 96 of file Vector3.php.

◆ cross()

pocketmine\math\Vector3::cross ( Vector3  $v)
inherited

Definition at line 253 of file Vector3.php.

◆ distance()

pocketmine\math\Vector3::distance ( Vector3  $pos)
inherited

Definition at line 214 of file Vector3.php.

◆ distanceSquared()

pocketmine\math\Vector3::distanceSquared ( Vector3  $pos)
inherited

Definition at line 218 of file Vector3.php.

◆ divide()

pocketmine\math\Vector3::divide ( float  $number)
inherited

Definition at line 92 of file Vector3.php.

◆ dot()

pocketmine\math\Vector3::dot ( Vector3  $v)
inherited

Definition at line 249 of file Vector3.php.

◆ down()

pocketmine\math\Vector3::down ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 129 of file Vector3.php.

◆ east()

pocketmine\math\Vector3::east ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 164 of file Vector3.php.

◆ equals()

pocketmine\entity\Location::equals ( Vector3  $v)

Reimplemented from pocketmine\world\Position.

Definition at line 67 of file Location.php.

◆ floor()

pocketmine\math\Vector3::floor ( )
inherited

Definition at line 100 of file Vector3.php.

◆ fromObject() [1/2]

static pocketmine\world\Position::fromObject ( Vector3  $pos,
?World  $world 
)
staticinherited
Returns
Position

Definition at line 45 of file Position.php.

Referenced by pocketmine\command\defaults\SpawnpointCommand\execute().

+ Here is the caller graph for this function:

◆ fromObject() [2/2]

static pocketmine\entity\Location::fromObject ( Vector3  $pos,
?World  $world,
float  $yaw = 0.0,
float  $pitch = 0.0 
)
static
Returns
Location

Definition at line 44 of file Location.php.

◆ getFloorX()

pocketmine\math\Vector3::getFloorX ( )
inherited

Definition at line 60 of file Vector3.php.

◆ getFloorY()

pocketmine\math\Vector3::getFloorY ( )
inherited

Definition at line 64 of file Vector3.php.

◆ getFloorZ()

pocketmine\math\Vector3::getFloorZ ( )
inherited

Definition at line 68 of file Vector3.php.

◆ getIntermediateWithXValue()

pocketmine\math\Vector3::getIntermediateWithXValue ( Vector3  $v,
float  $x 
)
inherited

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.

Definition at line 269 of file Vector3.php.

◆ getIntermediateWithYValue()

pocketmine\math\Vector3::getIntermediateWithYValue ( Vector3  $v,
float  $y 
)
inherited

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.

Definition at line 288 of file Vector3.php.

◆ getIntermediateWithZValue()

pocketmine\math\Vector3::getIntermediateWithZValue ( Vector3  $v,
float  $z 
)
inherited

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.

Definition at line 307 of file Vector3.php.

◆ getPitch()

pocketmine\entity\Location::getPitch ( )

Definition at line 59 of file Location.php.

◆ getSide()

pocketmine\world\Position::getSide ( int  $side,
int  $step = 1 
)
inherited

Returns a side Vector

Returns
Position

Reimplemented from pocketmine\math\Vector3.

Definition at line 87 of file Position.php.

◆ getWorld()

pocketmine\world\Position::getWorld ( )
inherited

Returns the position's world if valid. Throws an error if the world is unexpectedly invalid.

Exceptions
AssumptionFailedError

Definition at line 61 of file Position.php.

Referenced by pocketmine\block\Block\getSide().

+ Here is the caller graph for this function:

◆ getX()

pocketmine\math\Vector3::getX ( )
inherited

Definition at line 48 of file Vector3.php.

◆ getY()

pocketmine\math\Vector3::getY ( )
inherited

Definition at line 52 of file Vector3.php.

◆ getYaw()

pocketmine\entity\Location::getYaw ( )

Definition at line 55 of file Location.php.

◆ getZ()

pocketmine\math\Vector3::getZ ( )
inherited

Definition at line 56 of file Vector3.php.

◆ isValid()

pocketmine\world\Position::isValid ( )
inherited

Checks if this object has a valid reference to a loaded world

Definition at line 72 of file Position.php.

Referenced by pocketmine\block\Block\getSide().

+ Here is the caller graph for this function:

◆ length()

pocketmine\math\Vector3::length ( )
inherited

Definition at line 232 of file Vector3.php.

◆ lengthSquared()

pocketmine\math\Vector3::lengthSquared ( )
inherited

Definition at line 236 of file Vector3.php.

◆ maxComponents()

static pocketmine\math\Vector3::maxComponents ( Vector3  $vector,
Vector3 ...  $vectors 
)
staticinherited

Returns a new Vector3 taking the maximum of each component in the input vectors.

Parameters
Vector3...$vectors

Definition at line 343 of file Vector3.php.

◆ maxPlainDistance()

pocketmine\math\Vector3::maxPlainDistance ( Vector3|Vector2|float  $x,
float  $z = 0 
)
inherited

Definition at line 222 of file Vector3.php.

◆ minComponents()

static pocketmine\math\Vector3::minComponents ( Vector3  $vector,
Vector3 ...  $vectors 
)
staticinherited

Returns a new Vector3 taking the minimum of each component in the input vectors.

Parameters
Vector3...$vectors

Definition at line 360 of file Vector3.php.

◆ multiply()

pocketmine\math\Vector3::multiply ( float  $number)
inherited

Definition at line 88 of file Vector3.php.

◆ normalize()

pocketmine\math\Vector3::normalize ( )
inherited

Definition at line 240 of file Vector3.php.

◆ north()

pocketmine\math\Vector3::north ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 143 of file Vector3.php.

◆ round()

pocketmine\math\Vector3::round ( int  $precision = 0,
int  $mode = PHP_ROUND_HALF_UP 
)
inherited

@phpstan-param 1|2|3|4 $mode

Definition at line 107 of file Vector3.php.

◆ sides()

pocketmine\math\Vector3::sides ( int  $step = 1)
inherited

Yields vectors stepped out from this one in all directions.

Parameters
int$stepDistance in each direction to shift the vector
Returns
\Generator|Vector3[] @phpstan-return \Generator<int, Vector3, void, void>

Definition at line 176 of file Vector3.php.

◆ sidesAroundAxis()

pocketmine\math\Vector3::sidesAroundAxis ( int  $axis,
int  $step = 1 
)
inherited

Yields vectors stepped out from this one in directions except those on the given axis.

Parameters
int$axisFacing directions on this axis will be excluded
Returns
\Generator|Vector3[] @phpstan-return \Generator<int, Vector3, void, void>

Definition at line 199 of file Vector3.php.

◆ sidesArray()

pocketmine\math\Vector3::sidesArray ( bool  $keys = false,
int  $step = 1 
)
inherited

Same as sides() but returns a pre-populated array instead of Generator.

Returns
Vector3[]

Definition at line 187 of file Vector3.php.

◆ south()

pocketmine\math\Vector3::south ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 150 of file Vector3.php.

◆ subtract()

pocketmine\math\Vector3::subtract ( float|int  $x,
float|int  $y,
float|int  $z 
)
inherited

Definition at line 80 of file Vector3.php.

◆ subtractVector()

pocketmine\math\Vector3::subtractVector ( Vector3  $v)
inherited

Definition at line 84 of file Vector3.php.

◆ sum()

static pocketmine\math\Vector3::sum ( Vector3 ...  $vector3s)
staticinherited

Definition at line 372 of file Vector3.php.

◆ up()

pocketmine\math\Vector3::up ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 136 of file Vector3.php.

◆ west()

pocketmine\math\Vector3::west ( int  $step = 1)
inherited
Returns
Vector3

Definition at line 157 of file Vector3.php.

◆ withComponents()

pocketmine\math\Vector3::withComponents ( float|int|null  $x,
float|int|null  $y,
float|int|null  $z 
)
inherited

Returns a Vector3 with the provided components. If any of the components are null, the values from this Vector3 will be filled in instead. If no components are overridden (all components are null), the original vector will be returned unchanged.

Definition at line 331 of file Vector3.php.

◆ zero()

static pocketmine\math\Vector3::zero ( )
staticinherited

Definition at line 43 of file Vector3.php.

Member Data Documentation

◆ $pitch

float pocketmine\entity\Location::$pitch

Definition at line 33 of file Location.php.

◆ $world

World pocketmine\world\Position::$world = null
inherited

Definition at line 31 of file Position.php.

◆ $yaw

float pocketmine\entity\Location::$yaw

Definition at line 32 of file Location.php.


The documentation for this class was generated from the following file: