Skip to content

Getting Started (Variant Loader)

Aram edited this page Sep 11, 2025 · 16 revisions

This variant loader has been designed with the integrated loader in mind;


Getting Started with the Variant Loader

Overview

The Variant Loader allows you to register entity textures using a server-side data path, enabling users to create datapacks and resource packs to modify variants, entityData, and parameters.

Getting Started

Registration of Entity Textures

To begin using the Variant Loader, you need to register your JSON path by looping through all specified paths and loading all entities at once. This approach ensures all textures are preloaded, minimizing the likelihood of encountering missing textures during runtime. Here’s a basic implementation:

public class VariantProvider implements IVariantProvider {

    @Override
    public List<String> getEntityNames() {
        return List.of("entityOne", "entityTwo");
    }

    @Override
    public String getBasePath() {
        return IVariantProvider.super.getBasePath();
    }
}

Registering

Make sure to register the Provider in the constructor of your mod.

ReloadHandler.registerProvider(new VariantProvider());

Example

Resource Structure

When using the Variant Loader, your mod's resource structure should be organized to ensure that textures and JSON files are easily accessible and correctly linked. Below is an example of how your resource directory would be structured using the example code above.

src/
└── main/
    └── resources/
        ├── assets/
        |   └── <modid>/
        |       └── textures/
        |           └── entity/
        |               ├── entityOne/
        |               │   └── texture.png
        |               └── entityTwo/
        |                   └── texture.png
        └── data/
            └── <modid>/
                └── variant/
                    └── entity/
                        ├── entityOne/
                        │   ├── VariantOne.json
                        │   └── VariantTwo.json
                        └── entityTwo/
                            ├── VariantOne.json
                            └── VariantTwo.json

Key Points

  • Use ReloadHandler.setProvider(): Call this in your mod constructor or initialization event to register your VariantProvider and activate the loader.

By following this guide, you'll be able to effectively register and manage entity textures in your Minecraft mod using the Variant Loader. Happy modding!


Clone this wiki locally