Skip to content

Geo Models (Geckolib3)

Tslat edited this page Jul 3, 2023 · 8 revisions

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.

Creating a Geo Model

To create a new Geo Model, simply make a class that extends AnimatedGeoModel, then implement all the required methods:

getModelResource

This method should return the ResourceLocation path to your .geo.json model file for this animatable

getTextureResource

This method should return the ResourceLocation path to your .png texture file for this animatable

getAnimationResource

This method should return the ResourceLocation path to your .animation.json animation file for this animatable

Example Geo Model
public class JackInTheBoxModel extends AnimatedGeoModel<JackInTheBoxItem> {
	private static final ResourceLocation modelResource = new ResourceLocation(GeckoLib.ModID, "geo/jack.geo.json");
	private static final ResourceLocation textureResource = new ResourceLocation(GeckoLib.ModID, "textures/item/jack.png");
	private static final ResourceLocation animationResource = new ResourceLocation(GeckoLib.ModID, "animations/jackinthebox.animation.json");

	@Override
	public ResourceLocation getModelLocation(JackInTheBoxItem object) {
		return modelResource;
	}

	@Override
	public ResourceLocation getTextureLocation(JackInTheBoxItem object) {
		return textureResource;
	}

	@Override
	public ResourceLocation getAnimationFileLocation(JackInTheBoxItem object) {
		return animationResource;
	}
}

File Locations

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.

Models (.geo.json)

Model files have to go in resources/assets/<modid>/geo, or in any sub-directory thereof.

Animation Files (.animation.json)

Animation files have to go in resources/assets/<modid>/animations, or in any sub-directory thereof.

Textures (.png)

Textures are the same as in vanilla. They must go in resources/assets/<modid>/textures, or in any sub-directory thereof.

Table of Contents

Geckolib 3
Geckolib 4

Hosted By: Cloudsmith

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.

Clone this wiki locally