13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
22 public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET;
27 public int $extraData = -1;
28 public string $entityType =
":";
29 public bool $isBabyMob =
false;
30 public bool $disableRelativeVolume =
false;
35 public static function create(
int $sound,
Vector3 $position,
int $extraData,
string $entityType,
bool $isBabyMob,
bool $disableRelativeVolume) : self{
38 $result->position = $position;
39 $result->extraData = $extraData;
40 $result->entityType = $entityType;
41 $result->isBabyMob = $isBabyMob;
42 $result->disableRelativeVolume = $disableRelativeVolume;
46 public static function nonActorSound(
int $sound,
Vector3 $position,
bool $disableRelativeVolume,
int $extraData = -1) : self{
47 return self::create($sound, $position, $extraData,
":", false, $disableRelativeVolume);
51 $this->sound = $in->getUnsignedVarInt();
55 $this->isBabyMob = $in->
getBool();
56 $this->disableRelativeVolume = $in->
getBool();
60 $out->putUnsignedVarInt($this->sound);
63 $out->putString($this->entityType);
64 $out->putBool($this->isBabyMob);
65 $out->putBool($this->disableRelativeVolume);
69 return $handler->handleLevelSoundEvent($this);
static create(int $sound, Vector3 $position, int $extraData, string $entityType, bool $isBabyMob, bool $disableRelativeVolume)
decodePayload(PacketSerializer $in)
handle(PacketHandlerInterface $handler)
encodePayload(PacketSerializer $out)
putVector3(Vector3 $vector)