mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Location: change order of constructor parameters
to be consistent with Position::__construct() and Location::fromObject() (although Location::fromObject() has no choice, thanks to the anti-feature known as late static binding ...)
This commit is contained in:
parent
ee9f5e0044
commit
32a34d2494
@ -113,7 +113,7 @@ class TeleportCommand extends VanillaCommand{
|
||||
$x = $this->getRelativeDouble($base->x, $sender, $targetArgs[0]);
|
||||
$y = $this->getRelativeDouble($base->y, $sender, $targetArgs[1], 0, 256);
|
||||
$z = $this->getRelativeDouble($base->z, $sender, $targetArgs[2]);
|
||||
$targetLocation = new Location($x, $y, $z, $yaw, $pitch, $base->getWorld());
|
||||
$targetLocation = new Location($x, $y, $z, $base->getWorld(), $yaw, $pitch);
|
||||
|
||||
$subject->teleport($targetLocation);
|
||||
Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_tp_success_coordinates(
|
||||
|
@ -1185,9 +1185,9 @@ abstract class Entity{
|
||||
($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
|
||||
$this->boundingBox->minY - $this->ySize,
|
||||
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2,
|
||||
$this->location->world,
|
||||
$this->location->yaw,
|
||||
$this->location->pitch,
|
||||
$this->location->world
|
||||
$this->location->pitch
|
||||
);
|
||||
|
||||
$this->getWorld()->onEntityMoved($this);
|
||||
|
@ -34,7 +34,7 @@ class Location extends Position{
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
|
||||
public function __construct(float $x, float $y, float $z, float $yaw, float $pitch, ?World $world){
|
||||
public function __construct(float $x, float $y, float $z, ?World $world, float $yaw, float $pitch){
|
||||
$this->yaw = $yaw;
|
||||
$this->pitch = $pitch;
|
||||
parent::__construct($x, $y, $z, $world);
|
||||
@ -44,14 +44,14 @@ class Location extends Position{
|
||||
* @return Location
|
||||
*/
|
||||
public static function fromObject(Vector3 $pos, ?World $world, float $yaw = 0.0, float $pitch = 0.0){
|
||||
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $world ?? (($pos instanceof Position) ? $pos->world : null));
|
||||
return new Location($pos->x, $pos->y, $pos->z, $world ?? (($pos instanceof Position) ? $pos->world : null), $yaw, $pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Location instance
|
||||
*/
|
||||
public function asLocation() : Location{
|
||||
return new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->world);
|
||||
return new Location($this->x, $this->y, $this->z, $this->world, $this->yaw, $this->pitch);
|
||||
}
|
||||
|
||||
public function getYaw() : float{
|
||||
|
Loading…
x
Reference in New Issue
Block a user