mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Fixed PlaySoundPacket
thanks @undrfined
This commit is contained in:
parent
37b050f864
commit
6a717d8050
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user