Fixed PlaySoundPacket

thanks @undrfined
This commit is contained in:
Dylan K. Taylor 2017-08-28 18:32:56 +01:00
parent 37b050f864
commit 6a717d8050

View File

@ -32,23 +32,32 @@ use pocketmine\network\mcpe\NetworkSession;
class PlaySoundPacket extends DataPacket{ class PlaySoundPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET; const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
/** @var string */
public $soundName; public $soundName;
/** @var float */
public $x; public $x;
/** @var float */
public $y; public $y;
/** @var float */
public $z; public $z;
/** @var float */
public $volume; public $volume;
/** @var float */
public $pitch; public $pitch;
public function decodePayload(){ public function decodePayload(){
$this->soundName = $this->getString(); $this->soundName = $this->getString();
$this->getBlockPosition($this->x, $this->y, $this->z); $this->getBlockPosition($this->x, $this->y, $this->z);
$this->x /= 8;
$this->y /= 8;
$this->z /= 8;
$this->volume = $this->getLFloat(); $this->volume = $this->getLFloat();
$this->pitch = $this->getLFloat(); $this->pitch = $this->getLFloat();
} }
public function encodePayload(){ public function encodePayload(){
$this->putString($this->soundName); $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->volume);
$this->putLFloat($this->pitch); $this->putLFloat($this->pitch);
} }