From 02ca227085e4a3625a27ba9a0596d90783ff51d4 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Wed, 10 Sep 2014 12:23:23 +0200 Subject: [PATCH] Normalized Player pitch/yaw --- src/pocketmine/Player.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index e2278f1b6..36f90e127 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1355,7 +1355,18 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $dy = $newPos->y - $this->y; $dz = $newPos->z - $this->z; - $this->setRotation($packet->yaw % 360, $packet->pitch % 360); + $packet->yaw %= 360; + $packet->pitch %= 360; + + if($packet->yaw < 0){ + $packet->yaw += 360; + } + + if($packet->pitch < 0){ + $packet->pitch += 360; + } + + $this->setRotation($packet->yaw, $packet->pitch); //$this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z); $this->move($dx, $dy, $dz);