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 ExampleArmorItem extends Item implements GeoItem {
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);

public ExampleArmorItem(ArmorMaterial material, ArmorType type, Properties properties) {
super(properties.humanoidArmor(material, type));

// 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<GeoArmorRenderer<ExampleArmorItem>> renderer = Suppliers.memoize(() -> new GeoArmorRenderer<>(ExampleArmorItem.this));

@Override
public @Nullable GeoArmorRenderer<?, ?> getGeoArmorRenderer(ItemStack itemStack, EquipmentSlot equipmentSlot) {
return this.renderer.get();
}
});
}

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

}

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

Armor Renderer

// Applying the renderer
() -> new GeoArmorRenderer<>(ExampleArmorItem.this);