mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +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{
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user