From 6a717d8050b868fb45e28a33b9e0f2143a9cfcb8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Aug 2017 18:32:56 +0100 Subject: [PATCH] Fixed PlaySoundPacket thanks @undrfined --- .../network/mcpe/protocol/PlaySoundPacket.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php index cb6a5f61e..72d00aea1 100644 --- a/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php @@ -32,23 +32,32 @@ use pocketmine\network\mcpe\NetworkSession; class PlaySoundPacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET; + /** @var string */ public $soundName; + /** @var float */ public $x; + /** @var float */ public $y; + /** @var float */ public $z; + /** @var float */ public $volume; + /** @var float */ public $pitch; public function decodePayload(){ $this->soundName = $this->getString(); $this->getBlockPosition($this->x, $this->y, $this->z); + $this->x /= 8; + $this->y /= 8; + $this->z /= 8; $this->volume = $this->getLFloat(); $this->pitch = $this->getLFloat(); } public function encodePayload(){ $this->putString($this->soundName); - $this->putBlockPosition($this->x, $this->y, $this->z); + $this->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8)); $this->putLFloat($this->volume); $this->putLFloat($this->pitch); }