🔊 Playing sounds
Playing a sound while showing an animation could be that extra point your animation is missing. You can add sounds using the /animation sound add
command.
WARNING
You can play multiple sounds at once, but as of version 1.16 is limited to 8 sounds playing at once.
A sound is composed of the next values:
- Key: it is the sound identifier, composed of a namespace and its value. The default namespace is
minecraft
and the sound name format isnamespace:value
, but if you use a default minecraft sound or theminecraft
namespace, you don't need to include it. - Source: it tells the client what type of sound is being played. For example, if you send a
BLOCK
sound, and the player has the blocks sounds disable, won't hear the sound. - Pitch: a number from 0 to 2 determining the pitch the sound will be played at.
START INDEX
Remember that the frame list and the sound list start at index 0, so, the first frame corresponds to index 0, and the second, to index 1.
⚙ Adding to the animation
We are going to add the levelup sound to the last frame of our tutorial animation. We will add it with the PLAYER
as the source with a pitch of 2.0
.
- Command:
/animation sound add test 2 entity.player.levelup PLAYER 2.0
(As of we are using a minecraft default sound we don't need to include the sound namespace, but we could use minecraft:entity.player.levelup
too)
💫 Result
After all commands added, our config should looks like this.
animations:
test:
name: test
fps: 1.0
use-minimessage: true
frames:
- <gold>Welcome user!
- Thanks for using
- <gradient:#0EECFF:#008AE0>HyrexAnimations</gradient> :D
sounds:
2:
- namespace: minecraft
value: entity.player.levelup
source: PLAYER
pitch: 2.0
commands:
0:
- '[PLAYER] me Hello :D!'
2:
- '[CONSOLE] eco give %player% 10000'
- '[MESSAGE] <reset>Now you are the <gold><bold>richest<reset> user in the server'
And in-game looks like this:
🗑️ Deleting sounds
As with 🗑️ Deleting commands, you can delete a whole frame sounds, or only a sound of a specific frame. Use the /animation sound remove
command to do it, giving the animation, frame, and index if you want to delete a concrete sound.