Skip to content

SizableShrimp/EntityModelJson

Repository files navigation

Entity Model JSON

This is a Minecraft mod for Forge which allows declaring entity models in JSON. It can be used to create powerful entity models both in mods and modpacks. This is a 100% clientside only mod. Adding it to a server will do nothing.

For mods, entity models can be declared in JSON and shipped as assets in the final jar, with a required clientside dependency on this mod. For modpack makers, vanilla and modded entity models can be overriden in JSON using this system.

This mod also supports declaring entity animations (known as animation definitions) using JSON. For mods, entity animation definitions can be declared in JSON and shipped as assets in the final jar, with a required clientside dependency on this mod. This system cannot override animation definitions from vanilla or mods that use Java animations. However, modpack makers can override animations from other mods that utilize Entity Model JSON for animation.

Resources

Entity Models

For resources on how to declare and use JSON entity models, please see the following:

Entity Animation Definitions

For resources on how to declare and use JSON entity animation definitions, please see the following:

  • All vanilla entity animation definitions exported as JSON - This resource allows you to see how all vanilla entity animation definitions look in a JSON format. They can be used as a starting skeleton for animating your entities. Overriding vanilla entity animation definitions is not currently supported.
  • Example entity model - Demonstrates how to animate your entity using JSON entity animation definitions.

Creating/Editing Models in Blockbench

Entity Model JSON ships a Blockbench plugin which you can install for exporting and importing of files in the format of Entity Model JSON.

  1. Download the javaentitymodeljson_models.js file (Ctrl+S on most browsers). Make sure the file is saved with the same name! You should move this file to a place where you know it won't get deleted, as it will be loaded every time Blockbench starts.
  2. Open up Blockbench, and go to File > Plugins in the top-left of the window. Click on the local plugin install icon icon labeled Load Plugin from File.
  3. Select the javaentitymodeljson_models.js you saved previously.

You can use File > New > Java Entity Model JSON to create new Entity Model JSON files. Using File > Open Model (Ctrl+O) and selecting an Entity Model JSON file will also import it (without textures) into Blockbench.

To convert existing models to the Entity Model JSON format, go to File > Convert Project and select Java Entity Model JSON. To export Entity Model JSON files from Blockbench, navigate to File > Export > Export Java Entity Model JSON.

To export animations

Dumping vanilla & modded layer definitions

Entity Model Json supports dumping existing layer definitions in code to JSON. These files will export to your running game directory in a folder named layerexports! See /emj dump or /entitymodeljson dump in game for more information.

Declaring a mod dependency

To add this mod as a dependency, first add this to your repositories block:

repositories {
    // Entity Model JSON maven
    maven {
        url = 'https://maven.100media.dev'
    }
}

Then, add the dependency to your dependencies block. For the latest version, see here.

dependencies {
    implementation fg.deobf("me.sizableshrimp:entitymodeljson:${minecraft_version}-${entitymodeljson_version}")
}