PHP: $packet = new LevelSoundEventPacket();$packet->sound = 290;$packet->disableRelativeVolume = true; // This is the problem!$packet->position = $sender;$sender->sendDataPacket($packet); I have two problems. 1. The audio seems to be a bit off-tuned from the original. (The key seems to differ) 2. disableRelativeVolume is not working. So basically, when disableRelativeVolume is set to "true", the volume should be the same regardless of the position, which makes it so you can hear the sound from anywhere. Anyone know how to solve these issues?... Thanks!
DisableRelativeVolume doesn't seem to be working. Try this code below. PHP: foreach($this->plugin->getServer()->getOnlinePlayers() as $player){ $packet = new LevelSoundEventPacket(); $packet->sound = 290; $packet->position = $player->getPosition(); $player->sendDataPacket($packet); } If you want to modify the pitch/volume, use these objects below. PHP: $packet->volume = 1; // numeric$packet->pitch = 1; // numeric
Foreaching all online players won't solve the problem, since it will just play the sound at each locations And I don't think LevelSoundEventPacket doesn't have volume and pitch parem. Thanks for the reply though
Not true, The player will only hear one sound, because the packet sends it to the player. I've tested it on my devices. I may be mistaken though.