From 0f8a6481c6f6dbeeac791c4ac744cb9d9c5962d0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 24 Oct 2016 20:57:02 +0100 Subject: [PATCH] Fix snowball throw direction Blame Mojang, TODO: Revert this once the bug is fixed --- src/pocketmine/Player.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 431ce3096..f45aa31ed 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2000,7 +2000,11 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->level->sendBlocks([$this], [$target, $block], UpdateBlockPacket::FLAG_ALL_PRIORITY); break; }elseif($packet->face === -1){ - $aimPos = (new Vector3($packet->x / 32768, $packet->y / 32768, $packet->z / 32768))->normalize(); + $aimPos = new Vector3( + -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI), + -sin($this->pitch / 180 * M_PI), + cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI) + ); if($this->isCreative()){ $item = $this->inventory->getItemInHand();