
JsonEM (Json Entity Models)
Library for mod developers, resource pack creators, and modpack authors to create and edit entity models using JSON.
Note: Not compatible with OptiFine format!
Creating Reference Entity Models
If you need to obtain JSON versions of all entity models (vanilla or from mods) for subsequent editing via resource packs or use as examples, follow these steps:
Launch the game and open the configuration file at .minecraft/config/jsonem.properties
. Change the second line of the file to dump_models=true
. Restart the game and navigate to the .minecraft/jsonem_dump
folder. In this folder, you'll find all registered entity models in JSON format, organized as a resource pack. Use this format when editing or adding models through a resource pack.
Editing Models in Blockbench
To work with models in Blockbench, install the plugin from this repository.
Download the jsonem_models.js
file from the GitHub repository. In Blockbench, go to File > Plugins
and at the top of the dialog window, click the Load Plugin from File
icon. Select the jsonem_models.js
file. Navigate to File > New
and choose JsonEM Java Entity Model
to start editing. You can also use File > Open Model
to import a JsonEM JSON model file, such as those obtained from the game. To export your model for use with JsonEM, go to File > Export > Export JsonEM Java Entity Model
and save the file.
For Resource Pack and Modpack Creators
Complete the steps described above to obtain all entity models from your game or modpack. When editing your resource pack or modpack resources, add entity model JSON files in the same format as they appear in the obtained models folder.
For Mod Developers
JsonEM allows creating TexturedModelData for your entities entirely using JSON. This guide shows how to create the model for the cube entity from this tutorial using JSON.
Add the mod as follows (versions can be found here):
repositories {
maven { url "https://api.modrinth.com/maven" }
}
dependencies {
// Replace <version> with the desired version
modImplementation "maven.modrinth:jsonem:<version>"
include "maven.modrinth:jsonem:<version>"
}
Register the entity model layer for your entity through JsonEM instead of Fabric API (eliminates the need for code-generated TexturedModelData):
void onInitializeClient() {
[...]
JsonEM.registerModelLayer(MODEL_CUBE_LAYER); // Layer ID: "entitytesting:cube", Layer name: "main"
}
Add a model file to your mod resources containing your entity's model data:
Example: assets/entitytesting/models/entity/cube/main.json
{
"texture": {
"width": 64,
"height": 64
},
"bones": {
"cube": {
"transform": {
"origin": [0, 0, 0]
},
"cuboids": [
{
"uv": [0, 0],
"offset": [-6, 12, -6],
"dimensions": [12, 12, 12]
}
]
}
}
}
Make sure the bone "cube"
in the file above is accessed with the same name in your entity model:
public CubeEntityModel(ModelPart modelPart) {
this.base = modelPart.getChild("cube"); // The original tutorial used an unspecified field EntityModelPartNames.CUBE
}