Skip to main content
Version: GeckoLib5

Creating the GeoModel

For GeckoLib to work out where your replaced entity's asset files are, you need to create a GeoModel for the renderer.

Creating the class

💻Additive Code Section
All code snippets in this section add onto the previous code snippets, using a step-by-step approach to build the complete code.
Green highlights show added or modified lines of code for each step.

First, we create the model class itself:

public class ExampleReplacedEntityGeoModel {

}

Then we extend DefaultedEntityGeoModel, including our GeoReplacedEntity class as the generic type:

public class ExampleReplacedEntityGeoModel extends DefaultedEntityGeoModel<ExampleReplacedEntity> {

}

Next, we add the constructor and pass in the id of the asset files we want to use:

public class ExampleReplacedEntityGeoModel extends DefaultedEntityGeoModel<ExampleReplacedEntity> {
public ExampleReplacedEntityGeoModel() {
super(Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_replaced_entity"));
}
}

That's it!

The asset files

If you followed the above instructions, GeckoLib will be looking for your asset files (.geo.json, .animation.json, .png) in the /entity/ subdirectory, named the same as your target id.

For example, if your target id was registered as example_replaced_entity, your files should be:

  • Model: resources/assets/<mod_id>/geckolib/models/entity/example_replaced_entity.geo.json
  • Animations: resources/assets/<mod_id>/geckolib/animations/entity/example_replaced_entity.animation.json
  • Texture: resources/assets/<mod_id>/textures/entity/example_replaced_entity.png

Additional Information

For more information on GeoModels and how to use them, see the GeoModels pages.