Added teleport flag to MovePlayerPacket, improves player movement

This commit is contained in:
Shoghi Cervantes 2014-08-25 13:01:39 +02:00
parent 87b800ebb9
commit 46e502430e
2 changed files with 5 additions and 0 deletions

View File

@ -2323,6 +2323,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->bodyYaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->yaw = $this->yaw;
$pk->teleport = true;
$this->directDataPacket($pk);
}
}

View File

@ -30,6 +30,7 @@ class MovePlayerPacket extends DataPacket{
public $yaw;
public $pitch;
public $bodyYaw;
public $teleport = false;
public function pid(){
return Info::MOVE_PLAYER_PACKET;
@ -43,6 +44,8 @@ class MovePlayerPacket extends DataPacket{
$this->yaw = $this->getFloat();
$this->pitch = $this->getFloat();
$this->bodyYaw = $this->getFloat();
$flags = $this->getByte();
$this->teleport = (($flags & 0x80) > 0);
}
public function encode(){
@ -54,6 +57,7 @@ class MovePlayerPacket extends DataPacket{
$this->putFloat($this->yaw);
$this->putFloat($this->pitch);
$this->putFloat($this->bodyYaw);
$this->putByte($this->teleport == true ? 0x80 : 0x00);
}
}