tutorial:sounds
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:sounds [2020/05/16 19:35] – activate -> onUse yanis48 | tutorial:sounds [2021/02/06 10:33] – Added a warning about channel count magistermaks | ||
---|---|---|---|
Line 38: | Line 38: | ||
To play a sound, you first need a sound file. Minecraft uses the '' | To play a sound, you first need a sound file. Minecraft uses the '' | ||
If your sound file is in a different format (like the one in the provided link), you can use an online converter to convert from your format to '' | If your sound file is in a different format (like the one in the provided link), you can use an online converter to convert from your format to '' | ||
- | Now put your .ogg file in the '' | + | Make sure your sound has only one channel, otherwise the attenuation effect (gradual loss of volume with distance) won't be applied to it. |
+ | Now put your .ogg file in the '' | ||
==== Step 2: Add a sounds.json file, or add to it if you already have one ==== | ==== Step 2: Add a sounds.json file, or add to it if you already have one ==== | ||
Under '' | Under '' | ||
Line 69: | Line 70: | ||
public class ExampleMod { | public class ExampleMod { | ||
[...] | [...] | ||
- | public static final Identifier MY_SOUND_ID = new Identifier(" | + | public static final Identifier MY_SOUND_ID = new Identifier(" |
public static SoundEvent MY_SOUND_EVENT = new SoundEvent(MY_SOUND_ID); | public static SoundEvent MY_SOUND_EVENT = new SoundEvent(MY_SOUND_ID); | ||
} | } |
tutorial/sounds.txt · Last modified: 2023/01/09 18:20 by slainlight