mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-09 05:08:36 +00:00
fix crash whn player joins in spectator mode
This commit is contained in:
parent
9c46a1f141
commit
893f7cb6ef
@ -657,20 +657,22 @@ class NetworkSession{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function syncMovement(Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = MovePlayerPacket::MODE_NORMAL) : void{
|
public function syncMovement(Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = MovePlayerPacket::MODE_NORMAL) : void{
|
||||||
$location = $this->player->getLocation();
|
if($this->player !== null){
|
||||||
$yaw = $yaw ?? $location->getYaw();
|
$location = $this->player->getLocation();
|
||||||
$pitch = $pitch ?? $location->getPitch();
|
$yaw = $yaw ?? $location->getYaw();
|
||||||
|
$pitch = $pitch ?? $location->getPitch();
|
||||||
|
|
||||||
$pk = new MovePlayerPacket();
|
$pk = new MovePlayerPacket();
|
||||||
$pk->entityRuntimeId = $this->player->getId();
|
$pk->entityRuntimeId = $this->player->getId();
|
||||||
$pk->position = $this->player->getOffsetPosition($pos);
|
$pk->position = $this->player->getOffsetPosition($pos);
|
||||||
$pk->pitch = $pitch;
|
$pk->pitch = $pitch;
|
||||||
$pk->headYaw = $yaw;
|
$pk->headYaw = $yaw;
|
||||||
$pk->yaw = $yaw;
|
$pk->yaw = $yaw;
|
||||||
$pk->mode = $mode;
|
$pk->mode = $mode;
|
||||||
$pk->onGround = $this->player->onGround;
|
$pk->onGround = $this->player->onGround;
|
||||||
|
|
||||||
$this->sendDataPacket($pk);
|
$this->sendDataPacket($pk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function syncViewAreaRadius(int $distance) : void{
|
public function syncViewAreaRadius(int $distance) : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user