-
Notifications
You must be signed in to change notification settings - Fork 1
Adding sounds
Sounds are loaded and used in the mod based on their RecipeType names. If you've added a new machine or multiblock, you've most likely already done this here.
Sound files will be placed in the kubejs/assets/mi_sound_addon/sounds
folder. If you do not have the mi_sound_addon
and it's sounds
subfolder, you will need to create them. Sound files must be in the .ogg
file format. The name of the file in this location does not matter, as you will be defining the path to the resource in the next part. The file name does need to be all lowercase however.
Additionally, in the kubejs/assets/mi_sound_addon
directory, you will need to create a sounds.json
file. The JSON must be of the corresponding format below:
{
"your_custom_recipetype": {
"category": "block",
"sounds": [
"mi_sound_addon:your_file_name"
]
}
}
Please note that the path to your .ogg
file does NOT include the extension and MUST be prefixed with mi_sound_addon:
.
By default, sounds are given a duration of 60 ticks
or 3 seconds
. However this time doesn't always match to your sound, to modify this, you can create a startup script in KubeJS using the MISoundAddons.modifySounds
event. Here's an example of how to use that event in your startup script.
MISoundAddons.modifySounds(e => {
e.modifyDuration("your_custom_recipetype", 20);
e.modifyVolume("your_custom_recipetype", 0.75);
});
modifyDuration
changes the duration in ticks, not seconds. (There are 20 ticks in 1 second).
modifyVolume
changes the volume of the sound, on a scale from 0.0 - 1.0
. (I think you can go above 1.0, but it can make the sound extremely loud, use with caution).