Hello, I've been trying to play a custom sound from my server resource pack but it just doesn't work. I suppose that I have to use PlaySoundPacket, but how do I get the location of the sound there first?
Found the solution myself. You have to make a sound_definitions.json and define the custom sound names there and their location. Apply the texture pack and force it to all. Woala, just use PlaySoundPacket and you have it! Here is the code: PHP: $pk = new PlaySoundPacket; $pk->soundName = "yoursoundname"; $pk->x = (int)$this->player->x; $pk->y = (int)$this->player->y; $pk->z = (int)$this->player->z; $pk->volume = 1; $pk->pitch = 1; $this->player->dataPacket($pk); sound_definitions.json: Code: "yoursoundname": { "category": "music", "sounds": [{ "name": "sounds/location/soundname", "stream": true }] } I hope this will help
how do you expect the client to play a sound if it doesn't exist? it needs to have a resource pack downloaded with the sound inside it, otherwise it won't work. also what the hell does coding a sound mean?