mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 19:06:35 +00:00
Change last X/Y/Z/Yaw/Pitch on teleport
This commit is contained in:
parent
e44ed4da3b
commit
1963d8fde0
@ -1175,8 +1175,8 @@ abstract class Entity extends Location implements Metadatable{
|
||||
*/
|
||||
public function teleport(Vector3 $pos, $yaw = null, $pitch = null){
|
||||
if($pos instanceof Location){
|
||||
$yaw = $pos->yaw;
|
||||
$pitch = $pos->pitch;
|
||||
$yaw = $yaw === null ? $pos->yaw : $yaw;
|
||||
$pitch = $pitch === null ? $pos->pitch : $pitch;
|
||||
}
|
||||
$from = Position::fromObject($this, $this->level);
|
||||
$to = Position::fromObject($pos, $pos instanceof Position ? $pos->getLevel() : $this->level);
|
||||
@ -1192,6 +1192,17 @@ abstract class Entity extends Location implements Metadatable{
|
||||
$this->fallDistance = 0;
|
||||
$this->onGround = true;
|
||||
|
||||
$this->lastX = $this->x;
|
||||
$this->lastY = $this->y;
|
||||
$this->lastZ = $this->z;
|
||||
|
||||
$this->lastYaw = $this->yaw;
|
||||
$this->lastPitch = $this->pitch;
|
||||
|
||||
foreach($this->hasSpawned as $player){
|
||||
$player->addEntityMovement($this->getId(), $this->x, $this->y, $this->z, $this->yaw, $this->pitch);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user