mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Better Teleportation
This commit is contained in:
parent
7a0ff2a1c0
commit
eb90c777f3
1 changed files with 6 additions and 4 deletions
|
|
@ -478,19 +478,21 @@ class Player{
|
|||
));
|
||||
}
|
||||
|
||||
public function teleport(Vector3 $pos){
|
||||
public function teleport(Vector3 $pos, $yaw = 0, $pitch = 0){
|
||||
if($this->entity instanceof Entity){
|
||||
$this->entity->fallY = false;
|
||||
$this->entity->fallStart = false;
|
||||
$this->entity->setPosition($pos->x, $pos->y, $pos->z, 0, 0);
|
||||
$this->entity->setPosition($pos->x, $pos->y, $pos->z, $yaw, $pitch);
|
||||
$this->entity->calculateVelocity();
|
||||
$this->entity->updateLast();
|
||||
}
|
||||
$this->dataPacket(MC_MOVE_PLAYER, array(
|
||||
"eid" => 0,
|
||||
"x" => $pos->x,
|
||||
"y" => $pos->y,
|
||||
"z" => $pos->z,
|
||||
"yaw" => 0,
|
||||
"pitch" => 0,
|
||||
"yaw" => $yaw,
|
||||
"pitch" => $pitch,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue