This page will not cover how to code a Block Entity from the ground up, only how to add the required Azurelib code for the animations and model to work.
By default, Minecraft will search for a blockstate file in your assets folder to figure out how to render your block. Since the AzureLib renderer doesn't render based on a blockstate, we need to tell the game not to bother looking.
To do this, we need to override getRenderShape in our block and return the ENTITYBLOCK_ANIMATED type.
Create a new class that extends GeoModel, then implement all the required methods:
publicclassExampleBlockModelextendsGeoModel<ExampleBlockEntity> {// Models must be stored in assets/<modid>/geo with subfolders supported inside the geo folderprivatestaticfinalResourceLocation model =newResourceLocation("yournamespace","geo/yourmodel.geo.json");// Textures must be stored in assets/<modid>/textures with subfolders supported inside the textures folder private static final ResourceLocation texture = new ResourceLocation("yournamespace", "textures/<modeltype>/yourtexture.png");
// Animations must be stored in assets/<modid>/animations with subfolders supported inside the animations folder private static final ResourceLocation animation = new ResourceLocation("yournamespace", "animations/youranimation.animation.json");
@OverridepublicResourceLocationgetModelResource(ExampleBlockEntity object) {returnthis.model; } @OverridepublicResourceLocationgetTextureResource(ExampleBlockEntity object) {returnthis.texture; } @OverridepublicResourceLocationgetAnimationResource(ExampleBlockEntity object) {returnthis.animation; }}
Creating the renderer class
Create a class that extends GeoBlockRenderer, then just set it like so: