13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
21 public const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
23 public string $soundName;
33 public static function create(
string $soundName,
float $x,
float $y,
float $z,
float $volume,
float $pitch) : self{
35 $result->soundName = $soundName;
39 $result->volume = $volume;
40 $result->pitch = $pitch;
45 $this->soundName = $in->getString();
47 $this->x = $blockPosition->getX() / 8;
48 $this->y = $blockPosition->getY() / 8;
49 $this->z = $blockPosition->getZ() / 8;
55 $out->putString($this->soundName);
57 $out->putLFloat($this->volume);
58 $out->putLFloat($this->pitch);
62 return $handler->handlePlaySound($this);
handle(PacketHandlerInterface $handler)
encodePayload(PacketSerializer $out)
static create(string $soundName, float $x, float $y, float $z, float $volume, float $pitch)
decodePayload(PacketSerializer $in)
putBlockPosition(BlockPosition $blockPosition)