Everything You Need to Know About AzRendererConfigs
The AzRendererConfig
and its specialized subclasses (AzArmorRendererConfig
, AzBlockEntityRendererConfig
, AzEntityRendererConfig
, and AzItemRendererConfig
) are part of the AzureLib rendering pipeline.
Below, you will find an overview of each class, their purposes, and fully configured real-world usage examples.
AzRendererConfig
The base AzRendererConfig
class serves as the foundation for all rendering configuration subclasses. Its features include:
- Model and texture locations: Specify geo model and texture paths.
- Animation support: Integrate animations using
AzAnimator
. - Scaling options: Customize object scaling during rendering.
- Render layers: Add extra effects onto the rendering process.
- Pre- and post-render hooks: Perform operations at different stages of rendering.
- Customizable
RenderType
: Fine-tune rendering styles like cutouts, translucency, and more.
AzArmorRendererConfig
The AzArmorRendererConfig
is explicitly designed for rendering animated armor models. It provides options such as:
- Bone providers: A custom provider for managing custom bone structures
Example
Here’s an example of setting up an armor renderer with full configuration options:
public class ExampleArmorRenderer extends AzArmorRenderer {private static final ResourceLocation MODEL = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "geo/armor/examplearmor.geo.json");private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "textures/armor/examplearmor.png");public ExampleArmorRenderer() {super(AzArmorRendererConfig.builder(MODEL, TEXTURE).setAnimatorProvider(CustomArmorAnimator::new) // Custom animations.setBoneProvider(new CustomArmorBoneProvider()) // Bone provider for skeleton animations.setRenderType(RenderType.entityTranslucent(TEXTURE)) // Translucent rendering.setPrerenderEntry(context -> {// Insert code you want to run herereturn context;}) // Pre-render hook.setPostRenderEntry(context -> {// Insert code you want to run herereturn context;}) // Post-render hooksetScale(1.0F, 1.0F) // Scaling.build());}}
AzBlockEntityRendererConfig
The AzBlockEntityRendererConfig
specializes in rendering block entities.
Example
Here’s an example of setting up a block entity renderer with full configuration options:
public class ExampleBERenderer extends AzBlockEntityRenderer<ExampleBE> {private static final ResourceLocation MODEL = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "geo/block/examplebe.geo.json");private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "textures/block/examplebe.png");public ExampleBERenderer() {super(AzBlockEntityRendererConfig.<ExampleBE>builder(MODEL, TEXTURE).setAnimatorProvider(ExampleBEAnimator::new) // Custom animator.addRenderLayer(new CustomBlockRenderLayer()) // Add render layers.setPrerenderEntry(context -> {// Insert code you want to run herereturn context;}) // Pre-render hook.setPostRenderEntry(context -> {// Insert code you want to run herereturn context;}) // Post-render hook.setScale(1.0F, 1.0F) // Scaling.build());}}
This configuration adds scaling, render layers, hooks for pre- and post-rendering, and full animation support.
AzEntityRendererConfig
The AzEntityRendererConfig
supports rendering entities with death-specific behaviors such as rotation when the entity dies.
Example
Here’s an example of setting up an entity renderer with full configuration options:
public class ExampleEntityRenderer extends AzEntityRenderer<ExampleEntity> {private static final ResourceLocation MODEL = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "geo/entity/exampleentity.geo.json");private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "textures/entity/exampleentity.png");public ExampleEntityRenderer() {super(AzEntityRendererConfig.<ExampleEntity>builder(MODEL, TEXTURE).setAnimatorProvider(ExampleEntityAnimator::new) // Custom animator.setDeathMaxRotation(180F) // Custom death rotation.addRenderLayer(new CustomEntityRenderLayer()) // Add render layers.setPrerenderEntry(context -> {// Insert code you want to run herereturn context;}) // Pre-render hook.setPostRenderEntry(context -> {// Insert code you want to run herereturn context;}) // Post-render hook.setScale(0.8F, 0.8F) // Scaling options.build());}}
This implementation allows you to define rotations, animations, and layers for the entity.
AzItemRendererConfig
The AzItemRendererConfig
is tailored for rendering items.
It extends the flexibility of AzRendererConfig
by adding options for item-specific behaviors, such as GUI lighting and offset adjustments.
Example
Here’s an example of setting up an item renderer with full configuration options:
public class ExampleItemRenderer extends AzItemRenderer {private static final ResourceLocation MODEL = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "geo/item/exampleitem.geo.json");private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(YOUR_MOD_ID, "textures/item/exampleitem.png");public ExampleItemRenderer() {super(AzItemRendererConfig.builder(MODEL, TEXTURE).setAnimatorProvider(ExampleItemAnimator::new) // Custom animator.useEntityGuiLighting() // Enable GUI lighting.useNewOffset(true) // Use new offset for BlockBench 4.11+.addRenderLayer(new CustomItemRenderLayer()) // Add render layers.setPrerenderEntry(context -> {// Insert code you want to run herereturn context;}) // Pre-render hook.setPostRenderEntry(context -> {// Insert code you want to run herereturn context;}) // Post-render hook.setScale(1.0F, 1.0F) // Scaling options.build());}}
This setup provides GUI lighting support, offset handling, and numerous customization options for item rendering.