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{
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);
}