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:
Dylan K. Taylor 2021-10-29 15:43:09 +01:00
parent ee9f5e0044
commit 32a34d2494
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 6 additions and 6 deletions

View File

@ -113,7 +113,7 @@ class TeleportCommand extends VanillaCommand{
$x = $this->getRelativeDouble($base->x, $sender, $targetArgs[0]); $x = $this->getRelativeDouble($base->x, $sender, $targetArgs[0]);
$y = $this->getRelativeDouble($base->y, $sender, $targetArgs[1], 0, 256); $y = $this->getRelativeDouble($base->y, $sender, $targetArgs[1], 0, 256);
$z = $this->getRelativeDouble($base->z, $sender, $targetArgs[2]); $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); $subject->teleport($targetLocation);
Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_tp_success_coordinates( Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_tp_success_coordinates(

View File

@ -1185,9 +1185,9 @@ abstract class Entity{
($this->boundingBox->minX + $this->boundingBox->maxX) / 2, ($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
$this->boundingBox->minY - $this->ySize, $this->boundingBox->minY - $this->ySize,
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2,
$this->location->world,
$this->location->yaw, $this->location->yaw,
$this->location->pitch, $this->location->pitch
$this->location->world
); );
$this->getWorld()->onEntityMoved($this); $this->getWorld()->onEntityMoved($this);

View File

@ -34,7 +34,7 @@ class Location extends Position{
/** @var float */ /** @var float */
public $pitch; 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->yaw = $yaw;
$this->pitch = $pitch; $this->pitch = $pitch;
parent::__construct($x, $y, $z, $world); parent::__construct($x, $y, $z, $world);
@ -44,14 +44,14 @@ class Location extends Position{
* @return Location * @return Location
*/ */
public static function fromObject(Vector3 $pos, ?World $world, float $yaw = 0.0, float $pitch = 0.0){ 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 * Return a Location instance
*/ */
public function asLocation() : Location{ 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{ public function getYaw() : float{