Skip to content

CommandCoordinates 5.46.0 ​

final class · pocketmine\command\utils\CommandCoordinates · source

Parses command coordinates like Bedrock: absolute numbers, relative ones (~, ~5, ~-2.5) and local ones (^left ^up ^forward, relative to the origin's rotation; all three coordinates must be local then).

Constants ​

MAX_COORD ​

php
public const MAX_COORD = 30000000

MIN_COORD ​

php
public const MIN_COORD = -30000000

Methods ​

isCoordinate() ​

php
public static function isCoordinate(string $arg) : bool

Whether the argument is a coordinate: a number, or ~ / ^ optionally followed by a number.

parsePosition() ​

php
public static function parsePosition(\pocketmine\entity\Location $origin, string $x, string $y, string $z) : \pocketmine\math\Vector3

Resolves x y z arguments. Relative coordinates are added to the origin's position; local coordinates are offsets left, up and forward from it, following its yaw and pitch. X and Z are limited to +-30000000, Y to the world height.

parseRotation() ​

php
public static function parseRotation(float $current, string $arg) : float

Resolves a rotation argument (yRot or xRot): a number, or ~ / ~n relative to the current value.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.