How to Make a Sound
A custom sound is a config in the sounds/ folder that adds a new sound event from your own .ogg files: music, ambience, UI feedback, ability sounds, or anything else. Sounds are delivered through the resource pack and play like any vanilla sound, and can double as music discs. This page covers adding a sound, playing it, and overriding the client's language strings.
Quick start
Open
/plugins/EcoItems/sounds/.Copy
_example.ymland rename it to your sound's ID, e.g.battle_horn.yml.Put the audio at
pack/assets/ecoitems/sounds/battle_horn.ogginside the EcoItems plugin folder.Set
sound: battle_hornto point at the file.Run
/ecoitems reloadto rebuild the pack.Run
/playsound ecoitems:battle_horn player @ato confirm it plays.
Naming and IDs
The file name without .yml is the sound's ID. The sound plays as ecoitems:<id>, which is what /playsound, effects, and jukebox items reference.
The structure of a sound
| Part | What it controls |
|---|---|
| Category | The client volume slider the sound belongs to |
| Subtitle | The text shown when the sound plays with subtitles on |
| Sound files | The .ogg files played, and how each one plays |
| Jukebox | Optional registration as a music disc song |
# === Category: the volume slider ===
category: player # Optional; defaults to master
# === Subtitle ===
subtitle: "Battle Horn" # Optional
# === Sound files: what plays ===
sounds: # Multiple entries are picked at random, by weight
- sound: horns/battle_horn # pack/assets/ecoitems/sounds/horns/battle_horn.ogg
volume: 1.0 # Optional; defaults to 1.0
pitch: 1.0 # Optional; defaults to 1.0
weight: 2 # Optional; random-pick weight, defaults to 1
stream: false # Optional; stream from disk, for long sounds like music
attenuation-distance: 16 # Optional; audible range in blocks, defaults to 16
preload: false # Optional; load when the pack loads instead of on demand
- sound: horns/battle_horn_alt
# === Jukebox: optional music disc song ===
jukebox:
description: "Battle Horn" # The disc tooltip and now-playing text
length-seconds: 10 # How long the jukebox stays busy
comparator-output: 3 # Redstone comparator level, 1-15
range: 48 # Optional; audible range in blocks
Category
category is the client volume slider the sound belongs to: master, music, record, weather, block, hostile, neutral, player, ambient, or voice. It defaults to master.
Subtitle
subtitle is shown when the sound plays for players with subtitles enabled.
Sound files
Each entry is a [namespace:]path relative to sounds/, with no extension and the namespace defaulting to ecoitems. One entry plays as-is; multiple entries are picked at random, weighted by weight. An entry can also reference a vanilla sample by namespaced key (e.g. minecraft:dig/stone1) instead of a file in your pack.
Simple sounds can skip the list with sound: <name>, and a plain list of names works too:
sounds:
- horns/battle_horn
- horns/battle_horn_alt
Jukebox
A jukebox section registers the sound as a jukebox song through a generated datapack, which needs a server restart; the console tells you when. Any item with a jukebox_playable component pointing at the sound then becomes a working music disc:
item:
item: paper
components:
"minecraft:max_stack_size": 1
"minecraft:jukebox_playable": "ecoitems:welcome"
Playing a sound
After /ecoitems reload, play the sound with its namespaced ID:
/playsound ecoitems:battle_horn player @a
Or from any libreforge effect config, with the play_sound effect:
effects:
- id: play_sound
args:
sound: ecoitems:battle_horn
triggers:
- alt_click
Language files
The pack can also override the client's translation strings, with lang files at their normal vanilla location. Entries in pack/assets/minecraft/lang/global.json apply to every language at once, and per-language files like pack/assets/minecraft/lang/en_us.json override it for that language:
// pack/assets/minecraft/lang/global.json
{
"menu.disconnect": "§7See you soon!"
}
// pack/assets/minecraft/lang/en_us.json
{
"menu.returnToGame": "Back to the EcoItems experience"
}
Values support :glyph: placeholders (see How to Make a Glyph) and § color codes, and keys starting with _ are treated as comments. Any vanilla translation key can be overridden; the defaults EcoItems ships are only a starting point.
Where to go next
Effects: the play_sound effect to play sounds from items and triggers.
Blocks: How to Make a Block to use custom sounds for placing and breaking blocks.
The pack: Resource Packs for how sounds reach players.