-
-
Notifications
You must be signed in to change notification settings - Fork 128
Geo Models (Geckolib4)
Geo models are GeckoLib's way of tying together your animatable's resource (json) files, its animation handling, and various other miscellaneous data.
All animatable objects in GeckoLib have a Geo Model of some kind, and as such it is required that you create one for each that you make.
To create a new Geo Model
, simply make a class that extends GeoModel, then implement all the required methods:
This method should return the ResourceLocation
path to your .geo.json
model file for this animatable
This method should return the ResourceLocation
path to your .png
texture file for this animatable
This method should return the ResourceLocation
path to your .animation.json
animation file for this animatable
Example Geo Model
public class ExampleModel extends GeoModel<ExampleItem> {
private final ResourceLocation modelResource = new ResourceLocation(GeckoLib.ModID, "geo/example.geo.json");
private final ResourceLocation textureResource = new ResourceLocation(GeckoLib.ModID, "textures/item/examplepng");
private final ResourceLocation animationResource = new ResourceLocation(GeckoLib.ModID, "animations/example.animation.json");
@Override
public ResourceLocation getModelLocation(ExampleItem object) {
return this.model;
}
@Override
public ResourceLocation getTextureLocation(ExampleItem object) {
return this.textures;
}
@Override
public ResourceLocation getAnimationFileLocation(ExampleItem object) {
return this.animations;
}
}
As a minimum, GeckoLib requires that your asset (model, texture, animation) files be in certain directories in your resources folder. This is to allow for GeckoLib to easily find them. Once they are in these directories however, you are free to put them in any sub-directory of that folder, as long as your GeoModel
instance's methods reflect those locations.
Model files have to go in resources/assets/<modid>/geo
, or in any sub-directory thereof.
Animation files have to go in resources/assets/<modid>/animations
, or in any sub-directory thereof.
Textures are the same as in vanilla. They must go in resources/assets/<modid>/textures
, or in any sub-directory thereof.
New to GeckoLib4 are 'Defaulted' GeoModels. These are pre-designed model classes that allow you to make your model with next to no effort. They also encourage consistency of file organisation, and efficient model handling.
It is highly recommended that you use one of the defaulted model classes.
Click here for example
new DefaultedGeoEntityModel(new ResourceLocation(GeckoLib.MOD_ID, "bat"));
This creates a new GeoModel, and sets the following paths automagically:
- Texture:
textures/entity/bat.png
- Model:
geo/entity/bat.geo.json
- Animation:
animations/entity/bat.animation.json
Geckolib 3
Geckolib 4
- Installation
- Getting Started
- Upgrading from GeckoLib 3.1.x to 4.0
- Updating to GeckoLib 4.5
- Basic
- Advanced
- Miscellaneous
Package repository hosting is graciously provided by Cloudsmith.
Cloudsmith is the only fully hosted, cloud-native, universal package management solution that enables your organization to create, store and share packages in any format, to any place, with total confidence.