promotional bannermobile promotional banner

[DCME] Dynamic Contextual Music Engine

Replaces vanilla music with a dynamic soundtrack that reacts to biomes, time of day, weather, battles, bosses, structures, etc. Fully customizable via resource packs and JSON; no programming required

File Details

dcme-example-resourcepack

  • R
  • Apr 30, 2026
  • 7.31 KB
  • 0
  • 1.21.10
  • Fabric

File Name

dcme-example-resourcepack.zip

Supported Versions

  • 1.21.10

Curse Maven Snippet

Fabric

modImplementation "curse.maven:dcme-dynamic-contextual-music-engine-1460839:8015732"
Curse Maven does not yet support mods that have disabled 3rd party sharing

Learn more about Curse Maven

DCME (Dynamic Contextual Music Engine) - Resource Pack Guide

This is an example resource pack showing how to customize DCME. You can add your own music, create new contexts, or override existing ones - all without touching any code.


Quick Start

  1. Copy this folder into .minecraft/resourcepacks/
  2. Add your .ogg music files in assets/dcme/sounds/your_category/
  3. Register them in assets/dcme/sounds.json
  4. Create or edit context JSONs in assets/dcme/music_contexts/
  5. Activate the resource pack in Minecraft

Folder Structure

My-Music-Pack/
├── pack.mcmeta
├── README.md
└── assets/
    └── dcme/
        ├── sounds.json                    ← Register sound events
        ├── sounds/
        │   └── my_category/
        │       ├── track_1.ogg            ← Your music files
        │       ├── track_2.ogg
        │       └── boss_theme.ogg
        └── music_contexts/
            ├── my_new_context.json         ← New context (adds to defaults)
            ├── overworld_day.json          ← Override (same id replaces default)
            └── EXAMPLE_*.json.disabled     ← Disabled examples (ignored by mod)

Step 1: Add Sound Files

Place .ogg files (Vorbis codec) anywhere under assets/dcme/sounds/. Subdirectories become part of the path:

assets/dcme/sounds/my_overworld/peaceful_1.ogg
assets/dcme/sounds/my_overworld/peaceful_2.ogg
assets/dcme/sounds/my_boss/dragon_theme.ogg

Requirements: OGG Vorbis format, any sample rate (44100 Hz recommended), mono or stereo.


Step 2: Register in sounds.json

Each sound needs an entry in sounds.json. The key becomes the sound event ID, and "stream": true is required for music (long files).

{
  "my_overworld.peaceful_1": {
    "sounds": [
      {
        "name": "dcme:my_overworld/peaceful_1",
        "stream": true
      }
    ]
  },
  "my_overworld.peaceful_2": {
    "sounds": [
      {
        "name": "dcme:my_overworld/peaceful_2",
        "stream": true
      }
    ]
  },
  "my_boss.dragon_theme": {
    "sounds": [
      {
        "name": "dcme:my_boss/dragon_theme",
        "stream": true
      }
    ]
  }
}

Key: my_overworld.peaceful_1 → referenced as dcme:my_overworld.peaceful_1 in contexts.
Name: dcme:my_overworld/peaceful_1 → file path under sounds/ (with / not .).


Step 3: Create Contexts

Adding a New Context

Create a new JSON file in music_contexts/. The filename doesn't matter - only the "id" inside matters.

{
  "id": "cherry_grove",
  "priority": 25,
  "enabled": true,
  "group": "overworld_surface",
  "conditions": {
    "dimension": "overworld",
    "biomes": ["minecraft:cherry_grove"]
  },
  "tracks": [
    { "sound": "dcme:my_overworld.peaceful_1", "weight": 2 },
    { "sound": "dcme:my_overworld.peaceful_2", "weight": 1 }
  ],
  "play_once": true,
  "volume": 0.7,
  "fade_in_ms": 5000
}

Overriding an Existing Context

To replace the default overworld_day, create a file with "id": "overworld_day". The resource pack version completely replaces the built-in one:

{
  "id": "overworld_day",
  "priority": 10,
  "enabled": true,
  "group": "overworld_surface",
  "conditions": {
    "dimension": "overworld",
    "can_see_sky": true,
    "time_of_day": { "min": 1000, "max": 11500 }
  },
  "tracks": [
    { "sound": "dcme:my_overworld.peaceful_1", "weight": 1 },
    { "sound": "dcme:my_overworld.peaceful_2", "weight": 1 }
  ]
}

Disabling an Existing Context

Override it with "enabled": false:

{
  "id": "rain",
  "enabled": false,
  "priority": 38,
  "conditions": {},
  "tracks": []
}

Available Conditions

All conditions are AND logic. Omit any field to match anything.

Condition Type Example
dimension string "overworld", "the_nether", "the_end"
biomes string[] ["minecraft:cherry_grove", "#minecraft:is_forest"]
time_of_day range {"min": 1000, "max": 11500} - MC ticks, wraps around 24000
weather string "rain", "rain_only", "thunder", "clear", "precipitation", "snow"
altitude range {"min": -64, "max": 30}
can_see_sky boolean true / false
sky_light range {"min": 0, "max": 0} - 0 = underground
submerged_in string "water", "lava"
in_combat boolean true - player is in combat
combat_type string "pve", "pvp"
combat_entity string "minecraft:warden" - specific attacker entity
nearby_entity string or object "minecraft:ender_dragon" or {"entity": "...", "range": 128}
boss_bar_active boolean true - any boss bar visible
raid_active boolean true - village raid in progress
structures string[] ["minecraft:fortress", "minecraft:monument"]
structure string "minecraft:stronghold" - single structure shortcut
screen string "title", "credits"
health range {"min": 0, "max": 6} - in half-hearts
low_health boolean true - below config threshold
moon_phase integer 0 through 7
activity string "sleeping", "flying", "swimming", "riding", "sprinting", "sneaking", "fishing"
vehicle string "minecraft:horse", "minecraft:boat"
season string "spring", "summer", "fall", "winter" - requires season mod
has_advancement string "minecraft:end/kill_dragon"

Context Fields Reference

Field Type Default Description
id string required Unique ID. Same ID = override existing context
priority int required Higher priority wins. Base: 10-70, Override: 80-100
enabled boolean true Set false to disable
group string null Group for play_once logic (see below)
play_once boolean false Finish track before transitioning (same group only)
interrupt boolean false Fast crossfade on activation (for combat/boss)
release_base boolean false Free the base track's streaming slot during override (see below)
volume float global Per-context volume (0.0 - 1.0)
fade_in_ms int global Fade-in duration in milliseconds
fade_out_ms int global Fade-out duration in milliseconds
gap_between_tracks_seconds int global Silence between tracks
conditions object required When this context activates
tracks array required [{"sound": "dcme:id", "weight": 1}]

Combat vs Boss: release_base

When an override (combat/boss) activates, the base music fades to near-silence. The release_base field controls what happens to the base track's streaming slot:

release_base: false (default) - for combat contexts
The base track is held at near-zero volume. When combat ends, the base music resumes exactly where it left off - seamless transition. A 60-second safety timeout releases the slot if combat runs unusually long.

{
  "id": "combat_custom",
  "interrupt": true,
  "conditions": { "in_combat": true },
  "tracks": [...]
}

release_base: true - for boss contexts
The base track's streaming slot is freed immediately after a quick 1-second fade. This prevents resource exhaustion during long boss fights in heavy dimensions like The End. When the boss fight ends, a fresh base track starts instead of resuming.

{
  "id": "boss_custom",
  "interrupt": true,
  "release_base": true,
  "conditions": { "in_combat": true, "combat_entity": "minecraft:warden" },
  "tracks": [...]
}

Rule of thumb: Use release_base: true for any override context that lasts more than a minute (bosses, raids). Leave it false for short fights where seamless resume sounds better.


Groups & Play Once

When play_once is true, the current track finishes before transitioning - but only within the same group. Changing group always crossfades immediately.

Group Use For
overworld_surface Day, dawn, dusk, night, rain - surface biome music
overworld_underground Caves, deep dark
nether Nether dimension
end End dimension
screen Menu, credits
combat Combat contexts (override layer)
boss Boss contexts (override layer)

Examples:
- Dawn → Night (same group overworld_surface) → track finishes first ✓
- Day → Nether (different groups) → crossfade immediately ✓
- Underground → Surface (different groups) → crossfade immediately ✓

You can define your own group names for custom contexts.


Priority Guide

The mod picks the highest-priority matching context. Use this as a guide:

Priority Range Use For
100 Ender Dragon (highest)
90-99 Bosses (Wither, Elder Guardian)
80-89 Combat
60-79 Screens (menu, credits)
40-59 Special biomes (Deep Dark), underground
30-39 Weather (rain)
20-29 Time of day (dawn, dusk, night)
10-19 Default biome/dimension music

Track Weights

The weight field controls how likely a track is to be picked. Higher weight = more frequent:

"tracks": [
  { "sound": "dcme:my.common_track", "weight": 3 },
  { "sound": "dcme:my.rare_track", "weight": 1 }
]

Common track plays ~75% of the time, rare track ~25%.


Tips

  • Test quickly: Use /time set to change time of day and trigger context switches
  • Debug logging: Set "debugLogging": true in config/dcme.json to see which context is active
  • Biome tags: Use #namespace:tag syntax (e.g., "#minecraft:is_forest") to match multiple biomes
  • Resource pack priority: If multiple resource packs define the same context ID, the highest-priority pack wins
  • Config folder: For personal overrides, use config/dcme/contexts/ instead of a resource pack - it has the highest priority
  • Weather detail: "rain" excludes thunderstorms, "precipitation" includes both, "snow" detects snow biomes during rain

Transition Modes

DCME supports three transition modes between base contexts (configurable in config/dcme.json):

Mode Behavior
"crossfade" (Default) Old track fades out while new track fades in simultaneously
"gap" Old track fades out → silence gap (uses gap config) → new track fades in
"hybrid" Crossfade within same group, gap between different groups

The override layer (combat/boss) always uses fast crossfade regardless of this setting.


Third-Party Music Blocking

DCME blocks other mods from playing their own music (category MUSIC) to prevent conflicts. This is configurable in config/dcme.json:

"blockedMusicNamespaces": ["*"],     // Block ALL non-DCME music (default)
"allowedMusicSounds": []             // Whitelist specific sounds
  • ["*"] — blocks all non-DCME music (recommended)
  • ["aquamirae", "alexsmobs"] — block specific mods only
  • [] — block nothing (allow all mod music)
  • Jukebox music (RECORD category) is never blocked