-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Animation Sound(s)
LopyMine edited this page Sep 22, 2024
·
3 revisions
And finally, let's try to add our own sound for custom animation. Actually, there is nothing new if you ever added custom sounds to game with resource packs.
- First, we will need to get our sound. For example, I downloaded the piston activation sound from Internet, but it's
.mp3
which is wrong us.
- Because we will need to convert our sound from
.mp3
to.ogg
. For it, you can use any online converter. You cannot just rename file!
- Good, now we have the right sound. All that remains is to register this sound.
- First, we need to put this sound to
assets/namespace/sounds/
folder (for usnamespace
will bepatpat
folder). Second, we need to create file atassets/namespace/sounds.json
and register our sound in it. You can read this wiki to know more about this file.
Here is a simple example of this file content:
sounds.json
{
"here_you_must_write_unique_sound_id": {
"sounds": [
"namespace:here_you_must_write_your_sound_name_from_sounds_folder"
]
}
}
- Let's edit it for us:
sounds.json
{
"patpat_piston_sound_id": {
"sounds": [
"patpat:piston_sound"
]
}
}
- Finally, let's tell PatPat Mod, which sound we want to play with animation.
For it, we need to edit
animated_piston.json5
. Also, we will specify min/max pitch, and volume for our sound.
Here is what we want to add:
animated_piston.json5
{
// ...
"animation": {
// ...
"sound": {
"id": "patpat:patpat_piston_sound_id",
"min_pitch": 0.5,
"max_pitch": 1.5,
"volume": 0.8
},
// ...
}
// ...
}
See Full File
animated_piston.json5
{
"version": "1.0.0",
"animation": {
"texture": "patpat:textures/animated_piston.png",
"duration": 300,
"sound": {
"id": "patpat:patpat_piston_sound_id",
"min_pitch": 0.5,
"max_pitch": 1.5,
"volume": 0.8
},
"frame": {
"totalFrames": 5,
"scaleX": 1,
"scaleY": 1,
"offsetX": 0,
"offsetY": 0,
"offsetZ": 0
}
},
"entities": [
"minecraft:zombie"
]
}
- So, let's test our ready-to-use resource pack!