Skip to content

Intro: JMX for Mod Developers

grondag edited this page Jul 5, 2019 · 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 my maven repo to your build.gradle

repositories {
    maven {
    	name = "grondag"
    	url = "https://grondag-repo.appspot.com"
    	credentials {
            username "guest"
            password ""
	}
    }
}

And add JMX to your dependencies

dependencies {
    modCompile "grondag:jmx:0.2+"
    // remove next line if you want JMX to be an optional dependency       
    include "grondag:jmx:0.2+"

    // JMX needs FREX and Fermion and these are included in the JMX Maven JAR
    // so you *shouldn't* need to include them directly.  However, if for some
    // reason that doesn't work, you can include them with the following entries.

    // modImplementation "grondag:fermion:0.6+"
    // include "grondag:fermion:0.6+"
    // modImplementation "grondag:frex:0.7+"
    // include "grondag:frex:0.7.+"  
}

Note that version is subject to change - look at the repo to find latest.

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.

Clone this wiki locally