Hi there, I'm interested in trying to add custom sounds to a client-side resource package which the server can tell the clients to play at a certain time and at a certain location, but I have no idea how to implement it. I'd be grateful if someone could help me out with this one. Thanks! Edit: I'd prefer a method without having the web browser open in the background.
xMakerx Create a resource pack with new sounds (google it), then use World#playSound (Location, <thesoundyoureplaced> float, float) to play it to them.
I don't want to replace sounds though, I just want to add new ones. If possible can you or someone else explain this to me: https://forums.bukkit.org/threads/custom-sounds.267725/.
xMakerx Hmmm, well I would say copy that code and use it, but it was of exceptionally low quality and I'm constantly told you shouldn't be using reflection for this anyway, so I'd recommend examining that and creating maven modules to allow abstraction between versions etc.
xMakerx I didn't bother to read it all, and I can't examine it as I'm on my phone, but what you would basically have to do is change how the server hands the playong of a sound to allow for a custom path (alternatively, and this is the nastier approach, add a member to the enum using reflection that has the path to your sound).
There exists a playSound which takes a String, which presumably is somehow mappable to the sound path in the resource pack.
Thanks, but how would this be done? Can you post some code when you can access a computer? Can you write me some code as an example? That would be really helpful as I'm not understanding. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
It's a method on Player which takes a Location, sound name, volume, and pitch in that order. player.playSound(location, "path.to.sound", 1.0f, 1.0f)
So how would I point to my resource path? Let's say I have a folder named "myplugin" in the sound folder of my resource package, and a folder named "boss01" inside of that, would my path be: "sound/myplugin/boss01"?