NetworkBinaryStream: do not round vectors directly on reading

fixes #3199
This commit is contained in:
Dylan K. Taylor 2020-05-31 20:17:42 +01:00
parent 2dc3cf8162
commit 5056754cea
2 changed files with 4 additions and 4 deletions

View File

@ -2238,7 +2238,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
$newPos = $packet->position->round(4)->subtract(0, $this->baseOffset, 0);
if($this->isTeleporting and $newPos->distanceSquared($this) > 1){ //Tolerate up to 1 block to avoid problems with client-sided physics when spawning in blocks
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);

View File

@ -547,9 +547,9 @@ class NetworkBinaryStream extends BinaryStream{
*/
public function getVector3() : Vector3{
return new Vector3(
$this->getRoundedLFloat(4),
$this->getRoundedLFloat(4),
$this->getRoundedLFloat(4)
$this->getLFloat(),
$this->getLFloat(),
$this->getLFloat()
);
}