Skip to content

Getting Started

MORIMORI0317 edited this page Sep 23, 2024 · 6 revisions

1. Add SpecialModelLoader to your build.gradle file.

In your your mod's build.gradle file, declare the following statements to your repositories{} and dependencies{}.

repositories {
    maven {
        name = "FelNull Maven"
        url = "https://maven.felnull.dev"
    }
}
dependencies {
    modApi "dev.felnull:special-model-loader:1.3.0"
    
    //Required if you want this mod to be embedded by jar-in-jar
    include "dev.felnull:special-model-loader:1.3.0"
}

The version specified in dependencies should be rewritten to match the version to be used.

Gradle should download the required JavaDocs for your project. If not, you can find them here.

2. Specify the scope of model loading.

Scopes for loading should be specified to prevent unnecessary loading or conflicts with other mods.

Register a dedicated event during client initialization.

SpecialModelLoaderEvents.LOAD_SCOPE.register(event);

This event checks if a special model loading should be applied to the target model location.

Example of applying only to a specific namespace:

For versions before 1.3.0

public class ExampleModClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
        SpecialModelLoaderEvents.LOAD_SCOPE.register(location -> ExampleMod.MODID.equals(location.getNamespace()));
    }
}

For versions after 1.3.0

public class ExampleModClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
         SpecialModelLoaderEvents.LOAD_SCOPE.register(() -> {
            return (resourceManager, location) -> ExampleMod.MODID.equals(location.getNamespace());
        });
    }
}

Next: How To Use