Basic GeoModels
Basic GeoModels are the base way of referring to your asset files. They offer more flexibility than DefaultedGeoModels,
but require you to manually specify the resource paths for your assets.
Usage
GeoModels rely on creating a new class that extends GeoModel and implementing the three methods GeoModel requires:
getModelResource- This is the resource path to your modeljsonfile, relative to themodelsfolder.getAnimationResource- This is the resource path to your animationjsonfile, relative to theanimationsfolder.getTextureResource- This is the resource path to your texturepngfile, starting with thetexturesfolder.
Ideally, you would cache the Identifiers returned by these methods, so they're not re-created constantly.
See below for an example of a basic GeoModel class.
Example GeoModel class
public class ExampleGeoModel extends GeoModel<ExampleEntity> {
// Looks for a model file at '/assets/examplemod/geckolib/models/example_entity.geo.json'
private final Identifier modelPath = Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_entity");
// Looks for an animations file at '/assets/examplemod/geckolib/animations/example_entity.animation.json'
private final Identifier animationsPath = Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_entity");
// Looks for a texture file at '/assets/examplemod/textures/example_entity.png'
private final Identifier texturePath = Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_entity.png");
@Override
public Identifier getModelResource(GeoRenderState renderState) {
return this.modelPath;
}
@Override
public Identifier getAnimationResource(ExampleEntity animatable) {
return this.animationsPath;
}
@Override
public Identifier getTextureResource(GeoRenderState renderState) {
return this.texturePath;
}
}