Better Teleportation

This commit is contained in:
Shoghi Cervantes Pueyo 2013-03-20 18:32:47 +01:00
parent 7a0ff2a1c0
commit eb90c777f3

View File

@ -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,
));
}