Mercerenies / a-turtles-troll

Random Minecraft shenanigans
GNU General Public License v3.0
4 stars 2 forks source link

How to do custom sounds in the plugin #70

Open EvanSkiStudios opened 2 years ago

EvanSkiStudios commented 2 years ago

So in the resourcepack I edit a json that tells minecraft "oi mate I gots you a new sound file to play"

and i can call that with commands depending on the sound name I set for it in the json

{ "name.songs_sound": {"sounds":["name/songs/songs_sound"]}, }

In the example above the sound would be called by the string enum "name.songs_sound" in relation to the resourcepack, the sound would be in sounds/name/songs_sound.ogg

In the plugin you would call the sound like so user.playSound(Location, "name.songs_sound", 1.0f, 1.0f);

Reference link to the spigot api

So if we work together we can basically have infinite sounds for infinite scenarios No need to overwrite existing sounds in MC

So if we wanted we could replace the ghast sound we use for the angles with its own sound file, incase that sound ever gets used/removed by mojang

EvanSkiStudios commented 1 year ago

Examples seen here

https://github.com/EvanSkiStudios/Raccoon-Mischief/blob/master/RaccoonMischief/src/main/java/me/evanskistudios/rm/events/ListenerPlayerCraft.java#:~:text=all.playSound(player.getLocation()%2Csound%2C%201.0f%2C%201.0f)%3B

https://github.com/EvanSkiStudios/Raccoon-Mischief/blob/master/RaccoonMischief/src/main/java/me/evanskistudios/rm/events/ListenerPlayerDeath.java#:~:text=player.playSound(player.getLocation()%2C%20%22custom.player.no%22%2C%201.0f%2C%201.0f)%3B