mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 23:45:34 +00:00
Player: fixed PlayerMoveEvent->getFrom() returning unexpected results on movement reversion
fixes #4043
This commit is contained in:
parent
fac2bd3379
commit
78f9985377
@ -1653,13 +1653,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$deltaAngle = abs($this->lastYaw - $to->yaw) + abs($this->lastPitch - $to->pitch);
|
$deltaAngle = abs($this->lastYaw - $to->yaw) + abs($this->lastPitch - $to->pitch);
|
||||||
|
|
||||||
if($delta > 0.0001 or $deltaAngle > 1.0){
|
if($delta > 0.0001 or $deltaAngle > 1.0){
|
||||||
$this->lastX = $to->x;
|
|
||||||
$this->lastY = $to->y;
|
|
||||||
$this->lastZ = $to->z;
|
|
||||||
|
|
||||||
$this->lastYaw = $to->yaw;
|
|
||||||
$this->lastPitch = $to->pitch;
|
|
||||||
|
|
||||||
$ev = new PlayerMoveEvent($this, $from, $to);
|
$ev = new PlayerMoveEvent($this, $from, $to);
|
||||||
|
|
||||||
$ev->call();
|
$ev->call();
|
||||||
@ -1674,6 +1667,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->lastX = $to->x;
|
||||||
|
$this->lastY = $to->y;
|
||||||
|
$this->lastZ = $to->z;
|
||||||
|
|
||||||
|
$this->lastYaw = $to->yaw;
|
||||||
|
$this->lastPitch = $to->pitch;
|
||||||
$this->broadcastMovement();
|
$this->broadcastMovement();
|
||||||
|
|
||||||
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
||||||
@ -1696,13 +1695,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function revertMovement(Location $from) : void{
|
protected function revertMovement(Location $from) : void{
|
||||||
$this->lastX = $from->x;
|
|
||||||
$this->lastY = $from->y;
|
|
||||||
$this->lastZ = $from->z;
|
|
||||||
|
|
||||||
$this->lastYaw = $from->yaw;
|
|
||||||
$this->lastPitch = $from->pitch;
|
|
||||||
|
|
||||||
$this->setPosition($from);
|
$this->setPosition($from);
|
||||||
$this->sendPosition($from, $from->yaw, $from->pitch, MovePlayerPacket::MODE_RESET);
|
$this->sendPosition($from, $from->yaw, $from->pitch, MovePlayerPacket::MODE_RESET);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user