Skip to main content
Version: GeckoLib5

Copy-Paste Templates

Just looking for some template code to copy-paste?
See below for some existing code you can use to get you started.

Item Class

public class ExampleItem extends Item implements GeoItem {
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);

public ExampleItem(Properties properties) {
super(properties);

// Uncomment the below line to enable triggered animations
//GeoItem.registerSyncedAnimatable(this);
}

@Override
public void createGeoRenderer(Consumer<GeoRenderProvider> consumer) {
consumer.accept(new GeoRenderProvider() {
private final Supplier<GeoItemRenderer<ExampleItem>> renderer = Suppliers.memoize(() -> new GeoItemRenderer<>(ExampleItem.this));

@Override
public @Nullable GeoItemRenderer<ExampleItem> getGeoItemRenderer() {
return this.renderer.get();
}
});
}

@Override
public void registerControllers(final AnimatableManager.ControllerRegistrar controllers) {

}

@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.geoCache;
}
}

Item Renderer

// Applying the renderer
() -> new GeoItemRenderer<>(ExampleItem.this);

Item JSON

/assets/<modid>/items/<item_id>.json
{
"model": {
"type": "minecraft:special",
"base": "<modid>:item/<item_id>",
"model": {
"type": "geckolib:geckolib"
}
}
}
danger

Don't forget to change the <modid> and <item_id> values to match your mod and item!

Item Display JSON

/assets/<modid>/models/item/<item_id>.json
{
"parent": "builtin/entity",
"textures": {
"particle": "<modid>:item/<item_id>"
}
}
danger

Don't forget to change the <modid> and <item_id> values to match your mod and item!