-
Notifications
You must be signed in to change notification settings - Fork 21
Custom sounds for resource pack creators
Note
Resource pack structure will be following in general:
(root)
├ pack.mcmeta
├ pack.png (optional)
├ assets/
├ extrasounds/
├ sounds.json <- edit this!
Starting with Minecraft: Java Edition version 1.20.5, NBT tags have been replaced by components, and the number of components that can be specified has increased with each subsequent version.
Therefore, in ExtraSounds v3, now first searches for and returns the sound event based on the item model component.
This feature is particularly useful in the following situations:
- When you’re using a vanilla item ID but have modified only the item model and the name.
- When there’s a discrepancy between the visual appearance and the sounds defined in ExtraSounds.
Let’s assume there is an item with the following properties:
- Item ID:
minecraft:pumpkin_pie - Item model:
vanilla-food-exp:beef_sandwich - Nutrition: 10
- Saturation: 18
- Can be crafted using Bread and Steak
For this item, ExtraSounds v3 first looks for extrasounds:item.pickup.vanilla-food-exp.beef_sandwich.
If this sound event does not exist, then looks for extrasounds:item.pickup.minecraft.pumpkin_pie.
To use a resource pack to modify this sound to the same one as minecraft:bread, you can use the following sounds.json file.
sounds.json:
{
"item.pickup.vanilla-food-exp.beef_sandwich": {
"sounds": [
{
"name": "extrasounds:item.pickup.minecraft.bread",
"type": "event"
}
]
},
"item.place.vanilla-food-exp.beef_sandwich": {
"sounds": [
{
"name": "extrasounds:item.place.minecraft.bread",
"type": "event"
}
]
},
"item.select.vanilla-food-exp.beef_sandwich": {
"sounds": [
{
"name": "extrasounds:item.select.minecraft.bread",
"type": "event"
}
]
}
}The three entries - pickup, place, and select - are required. If you define sound events via a resource pack, the automatically generation feature will not work.
Please refer to the next section for the automatically generation feature and difference in these three sound names.
The majority of sounds in this mod are generated automatically based on their classes or properties.
All of the sounds’ names follow a simple convention - item.pickup.[namespace].[itemId],
and also two names will be generated together - item.place.[namespace].[itemId], item.select.[namespace].[itemId].
-
item.pickup.[namespace].[itemId]- Plays very often. If you define this, it will work well in most cases.
-
item.place.[namespace].[itemId]- Plays when ItemStack is placed on Inventory screen using mouse. This sounds’ pitch is always multiplied by 0.9.
If not defined, it refers to
item.pickup.[namespace].[itemId].
- Plays when ItemStack is placed on Inventory screen using mouse. This sounds’ pitch is always multiplied by 0.9.
If not defined, it refers to
-
item.select.[namespace].[itemId]- Plays when Item is selected on Hotbar using mouse wheel or keyboard.
If not defined, it refers to
item.pickup.[namespace].[itemId].
- Plays when Item is selected on Hotbar using mouse wheel or keyboard.
If not defined, it refers to
Some examples can be found in the included sounds.json that has entries for items that cannot be automatically generated.
This would replace the stick’s click sound to a villager dying:
sounds.json
{
"item.pickup.minecraft.stick": {
"sounds": [
{
"name": "minecraft:entity.villager.death",
"type": "event"
}
],
"replace": true
}
}To get a full list of all sounds, including the ones that were generated automatically,
you may run Minecraft with the -Dextrasounds.debug=true argument added to your Java options.
This will create a debug folder containing a sounds.json.
The JSON is compacted, so you might also want to automatically reformat it to be more readable.
For the sake of organization, ExtraSounds adds sound categories for item clicks -
that is, items that share the same sound just point to the same category.
All of the categories you can find here starting with item.category.*.
This would make all records play stal when clicked:
sounds.json
{
"item.category.music_disc": {
"sounds": [
{
"name": "minecraft:music_disc.stal",
"type": "event"
}
],
"replace": true
}
}The generated sounds are grouped into some categories, and you can adjust these volumes for each category by selecting gear button of ExtraSounds on the “Music & Sounds” screen of Minecraft game options.
If for some reason you wish to mute a specific sound, the following methods can be applied.
This would make all scroll sounds silence for Hotbar, Inventory and Chat log screen:
sounds.json
{
"generic.scroll": {
"sounds": [
{
"name": "extrasounds:muted",
"type": "event"
}
],
"replace": true
}
}To verify the JSON file (and have autofill if your editor supports it), you may use the provided sound-schema.json with your code editor.