Playing sounds

  • so i wrote a quick plugin to play a sound effect. i noticed so far that only warning_proximity and watermelon_slice effects play where others mentioned in the api such as bear_hunt do not. is it possible to get other sounds working soon and are we only limited to interaction sounds? i tried several ambient and music names but none worked.


    Also, a way to kill all sounds within a certain category without knowing the id of the sound events would be helpful. something like killAllSounds("Interaction") would be nice.

  • Well, actually all sounds are working, however, the Player.playGameSound(String soundname) method (which does not take a position parameter) does not work as intended: it is supposed to use the current player position, instead if does not use a position at all (so the sound plays at position 0 0 0). This will be fixed with the next update, in the meantime, just use the Player.playGameSound(String soundname, Vector3f position) method instead ;)
    But this only works for sound effects, you can't play music that way.


    Btw, also take into account that most sounds have a limited number of playing instances (this is only relevant as long as the sound is actually playing - unless it's a loop sound, it will be released automatically after playing).


    About a "killAllSounds()" method, basically we could implement it, but it's getting problematic when using multiple plugins (since such a method would kill all sounds). I think it's better if you just keep a reference to your sound id (it's anyway only necessary for loop sounds)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!