Heads up!
This page assumes you have exported the assets properly as per How to Export Your Project
You can find working examples for 1.21.1 here
Creating your Renderer
This renderer is responsible for how your custom item is displayed in the game.
It connects the item with the following:
- Geometry file (
geo.json
): Defines the 3D model of the item. - Texture file (
.png
): The visual appearance of the item (applies over the geometry).
Heads up!
See AzRendererConfigs 101 for all AzItemRendererConfig#builder options.
For 1.20.1 and below use, new ResourceLocation() instead of ResourceLocation.fromNamespaceAndPath()
Heads up!
There is currently a bug in the plugin which exports the displays with an offset applied, please use useNewOffset(true) in your AzItemRendererConfig builder to fix this.
public class ExampleItemRenderer extends AzItemRenderer {private static final ResourceLocation GEO = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID,"geo/item/exampleitem.geo.json");private static final ResourceLocation TEX = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID,"textures/item/exampleitem.png");public ExampleItemRenderer() {super(AzItemRendererConfig.builder(GEO, TEX).build());}}
Registering your Renderer
Now simply call the AzItemRendererRegistry#register()
in your onInitializeClient
for Fabric and FMLClientSetupEvent
for Neoforge/Forge
AzItemRendererRegistry.register(ExampleItemRenderer::new, YourItemRegistry.YOUR_ITEM);