Changes

398 bytes added ,  01:20, 8 August 2021
m
Add note about mono sounds and attenuation.
Line 17: Line 17:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Using the example above, it creates a sound called <code>example_sound</code> and references the file <code><nowiki>assets/<modid>/sounds/example_sound_file.ogg</nowiki></code>.  
+
Using the example above, it creates a sound called <code>example_sound</code> and references the file <code><nowiki>assets/<modid>/sounds/example_sound_file.ogg</nowiki></code>.  
 +
 
 +
 
 +
{{Tip/Danger | Due to [https://bugs.mojang.com/browse/MC-146721 the way OpenAL (Minecraft's sound engine) works], for your sound to have attenuation - that is, for it to get quieter as the player walks away, it absolutely MUST be mono (have one audio channel). 
 +
 
 +
Stereo sounds are always played at the '''player's''' location, making them ideal for ambient sounds and background music.
 +
 
 +
}} 
 +
 
    
Instead of being constructed as a list of strings, each entry could also be an object which allows a greater control over what and how it is played.
 
Instead of being constructed as a list of strings, each entry could also be an object which allows a greater control over what and how it is played.