Skip to content

Intro: JMX for Mod Developers

grondag edited this page Dec 22, 2021 · 14 revisions

Mod Developers can use JMX to create enhanced models for modded blocks and items using the same workflow as for vanilla Minecraft models.

Adding JMX to the Dev Environment

Add the maven repo where my libraries live to your build.gradle

repositories {
    maven {
    	name = "ram"
    	url = "https://maven.vram.io/"
    }
}

And add JMX and FREX to your dependencies

dependencies {
  modImplementation("io.vram:frex-fabric-mc118:6.0.+")
  // remove next line if you want JMX to be an optional dependency
  // The "fat" suffix causes all bundled dependencies to be included
  include("io.vram:frex-fabric-mc118:6.0.+:fat")
	
  modImplementation "io.vram:jmx-fabric-mc118:1.22.+"
  // remove next line if you want JMX to be an optional dependency 
  include "io.vram:jmx-fabric-mc118:1.22.+"
}

JMX is built for specific Minecraft versions, indicated by mcXXX. Minecraft 1.17.x has tag mc117.

Consult the gradle.properties file for the latest major.minor version numbers.

Using JMX as an Optional Dependency

If your JSON model files include all attributes necessary for vanilla models, then JMX can be an optional dependency for your mod. (Of course, your models will not have enhanced features unless JMX is present.)

To make JMX optional, implement grondag.jmx.api.JmxInitializer on a class that is not referenced from any code that will run when JMX is absent. Then add that class name as a jmx entry point in your fabric.mod.json file. See the comments on JmxInitializer for more information.