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 [2019/08/13 15:31] – fixed dedis crash fudge | tutorial:sounds [2020/02/11 20:23] – The purpose of the player argument is not unknown earthcomputer | ||
---|---|---|---|
Line 7: | Line 7: | ||
if (!world.isClient) { | if (!world.isClient) { | ||
world.playSound( | world.playSound( | ||
- | null, // Player | + | null, // Player |
blockPos, // The position of where the sound will come from | blockPos, // The position of where the sound will come from | ||
SoundEvents.BLOCK_ANVIL_LAND, | SoundEvents.BLOCK_ANVIL_LAND, | ||
Line 51: | Line 51: | ||
} | } | ||
</ | </ | ||
- | You can also add a category and subtitle to your sound: | + | You can also add a subtitle to your sound. The subtitle is a translation key, which should go in your language file. |
<code javascript resources/ | <code javascript resources/ | ||
{ | { | ||
" | " | ||
- | | + | " |
- | | + | |
" | " | ||
" | " | ||
Line 63: | Line 62: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | See the [[https:// | ||
==== Step 3: Create your sound event ==== | ==== Step 3: Create your sound event ==== | ||
Simply create a new instance of '' | Simply create a new instance of '' | ||
Line 89: | Line 90: | ||
if (!world.isClient) { | if (!world.isClient) { | ||
world.playSound( | world.playSound( | ||
- | null, // Player | + | null, // Player |
blockPos, // The position of where the sound will come from | blockPos, // The position of where the sound will come from | ||
ExampleMod.MY_SOUND_EVENT, | ExampleMod.MY_SOUND_EVENT, |
tutorial/sounds.txt · Last modified: 2023/01/09 18:20 by slainlight