Creating a DMZ Addon
Creating a DMZ Addon walks you through a full Forge add-on that integrates with DragonMineZ: your own mod jar that depends on DMZ and can react to its events and data. Read Add-on Getting Started first for the required toolchain and versions.
Step 1: Create a Forge 1.20.1 project
Start from the Forge MDK for Minecraft 1.20.1 with Forge 47.4.10, ForgeGradle 6.0.30 and Java 17, matching DMZ.
These files of the DMZ repository are useful references for your project structure and setup:
gradle.propertiesbuild.gradle.ktssrc/main/resources/META-INF/mods.toml
Step 2: Set up Gradle
DMZ uses the Kotlin Gradle DSL (build.gradle.kts), but you can use Groovy Gradle or any other setup you prefer for your add-on. Just make sure the Forge and Java versions match. A build.gradle.kts example:
plugins {
java
idea
id("net.minecraftforge.gradle") version "6.0.30"
id("org.parchmentmc.librarian.forgegradle") version "1.+"
id("org.spongepowered.mixin") version "0.7.38"
}
repositories {
maven("https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/") // GeckoLib
maven("https://maven.blamejared.com/") // TerraBlender
maven("https://maven.theillusivec4.top/") // Curios
flatDir { dirs("libs") } // local DMZ jar
mavenCentral()
}
minecraft {
mappings("parchment", "2023.09.03-1.20.1")
runs {
configureEach {
workingDirectory(project.file("run"))
// DMZ ships mixins: let the dev runtime remap their refmap
property("mixin.env.remapRefMap", "true")
property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")
}
create("client")
create("server")
}
}
dependencies {
minecraft("net.minecraftforge:forge:1.20.1-47.4.10")
annotationProcessor("org.spongepowered:mixin:0.8.7:processor")
// DMZ's mandatory dependencies: GeckoLib, TerraBlender & Curios
implementation(fg.deobf("software.bernie.geckolib:geckolib-forge-1.20.1:4.8.3"))
implementation("com.eliotlash.mclib:mclib:20")
implementation(fg.deobf("com.github.glitchfiend:TerraBlender-forge:1.20.1-3.0.1.10"))
compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:5.14.1+1.20.1:api"))
runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:5.14.1+1.20.1"))
// DragonMineZ itself (libs/dragonminez-2.2-alpha.jar)
implementation(fg.deobf("local:dragonminez:2.2-alpha"))
}
Step 3: Declare the DMZ dependency
In your add-on's mods.toml, add a dependency entry for dragonminez:
[[dependencies.your_addon_modid]]
modId="dragonminez"
mandatory=true # false if your addon also works without DMZ
versionRange="[2.2-alpha]" # Only allow the DMZ version you built against to avoid compatibility issues.
ordering="AFTER"
side="BOTH" # Choose between "CLIENT", "SERVER", or "BOTH" based on your addon needs.
Set mandatory to false if your add-on also works without DMZ (see Optional dependency pattern). DMZ's own mods.toml uses displayTest = "MATCH_VERSION", so the client and the server must run the same DMZ version anyway.
Step 4: Add DMZ to the compile classpath
DMZ's build does not publish a Maven artifact, so use a local jar during development:
- Download the DMZ release you target, or build it yourself with
./gradlew buildin the DMZ repository. - Use the no-classifier jar (
dragonminez-<version>.jar): it bundles DMZ's database libraries. The-slimjar is not meant to be used. - Put it in your project's
libs/folder and reference it throughfg.deobf(...)as shown above, so ForgeGradle remaps it to your development mappings.
Use compileOnly instead of implementation if you only want to compile against DMZ and run it from a separate instance.
Step 5: Listen to DMZ events
DMZ publishes its server and common Forge events as nested classes of com.dragonminez.common.events.DMZEvent, and its client events as nested classes of com.dragonminez.client.events.DMZClientEvent. For example:
@Mod.EventBusSubscriber(modid = "your_addon_modid", bus = Mod.EventBusSubscriber.Bus.FORGE)
public class DmzHooks {
@SubscribeEvent
public static void onTpGain(com.dragonminez.common.events.DMZEvent.TPGainEvent event) {
// Example: increase TP gain by 10%
int boosted = Math.round(event.getTpGain() * 1.10f);
event.setTpGain(boosted);
}
}
The event source files are src/main/java/com/dragonminez/common/events/DMZEvent.java and src/main/java/com/dragonminez/client/events/DMZClientEvent.java. The full list, plus the quest objective and reward registries, text placeholders and utility menu slots, is on Implementation and Events.
Suggested add-on structure
your/addon/MainModClass.javayour/addon/event/DmzHooks.javasrc/main/resources/META-INF/mods.tomlsrc/main/resources/pack.mcmeta
First milestone checklist
- The add-on loads without crashing in the development client.
- DMZ is detected when present.
- One DMZ event is received in the logs.
- One behavior change is visible in game.
Compatibility recommendations
- Guard code paths that only work with DMZ behind mod-presence checks.
- Log clear warnings when DMZ is missing or its version is incompatible.
- Don't bundle or depend on Legendary Tooltips, Epic Fight or Better Combat: DMZ refuses to start alongside them.
- Use your own network channel, and never trust client input for progression (see Networking).