Renderers
Examples on this page use Identifier from net.minecraft.resources, RenderType from net.minecraft.client.renderer.rendertype, and the state interfaces in com.arcanc.pulselib.content.renderer.base.
A PulseLib renderer is the bridge between Minecraft's render call and PulseLib's baked animated model. It gets the current animatable, asks for model data, binds the animation manager to the baked model, and submits every posed bone to the render queue.
All built-in renderers implement PRenderer and use the same submit lifecycle:
preSubmit(...)- hook before PulseLib submits model meshes.trueSubmit(...)- default PulseLib model submission.postSubmit(...)- hook after model submission.
Most custom renderers need a model-data constructor and a render-state implementation. Each model used by the renderer must also be registered as a PModelResource, including all of its material texture references; resource registration controls which models PulseLib loads. See Resources. Override preSubmit or postSubmit when you need to submit extra PulseLib geometry or collector nodes around the model.
Molang context
The built-in entity, block entity, and item renderers prepare a Molang context once per controller and render pass, then reuse it for all mixed bones. Override populateMolangContext(...) to add renderer-specific query.* values. Custom queries and persistent per-controller variable.* state are documented in Molang animations.
Block renderer
Use PBlockRenderer for block entities. The block itself should hide vanilla rendering; the block entity renderer becomes the visible model.
public class CrusherRenderer extends PBlockRenderer<CrusherBlockEntity, CrusherRenderState>
{
public CrusherRenderer(BlockEntityRendererProvider.Context context)
{
super(PModelData.block(
Identifier.fromNamespaceAndPath("examplemod", "crusher")),
PRenderTypes.RenderTypeProvider::trianglesCutout);
}
@Override
public CrusherRenderState createRenderState()
{
return new CrusherRenderState();
}
}
public class CrusherRenderState extends PBlockRenderState.Impl<CrusherBlockEntity>
{
}
Register it in your loader's client setup. NeoForge uses the mod-bus event below:
@SubscribeEvent
public static void registerRenderers(EntityRenderersEvent.RegisterRenderers event)
{
event.registerBlockEntityRenderer(MyBlockEntities.CRUSHER.get(), CrusherRenderer::new);
}
Fabric uses the same renderer class:
BlockEntityRendererRegistry.register(MyBlockEntities.CRUSHER.get(), CrusherRenderer::new);
BlockEntityRendererRegistry is in Fabric API's net.fabricmc.fabric.api.client.rendering.v1 package. The registry holders shown here are placeholders for your mod's block-entity type references.
Item renderer
Use PItemRenderer when the item model needs real animation instead of a static baked item JSON. The item must implement PAnimatable.
public class WandRenderer extends PItemRenderer<WandItem, WandRenderState>
{
public WandRenderer(PModelData modelData)
{
super(modelData,
PRenderTypes.RenderTypeProvider::trianglesSolid);
}
@Override
protected WandRenderState createRenderState()
{
return new WandRenderState();
}
}
public class WandRenderState extends PItemRenderState.Impl<WandItem>
{
}
For standard special item models, modelData is decoded from the item JSON. See PulseLib Items for the matching resource registration.
In GUI context, PItemRenderer executes in an isolated local scope and flushes that local compiler when the scope closes. It does not drain world submissions. In FIRST_PERSON_LEFT_HAND and FIRST_PERSON_RIGHT_HAND contexts, it submits to the dedicated FIRST_PERSON stage, which PulseLib flushes and composites immediately after the current hand pass. An enabled player first-person animation adjusts the arm or item pose inside that normal vanilla pass; it does not replace the pass. The renderer preserves the render type supplied to its constructor; use a render type compatible with the contexts in which the item is displayed.
Entity renderer
Use PEntityRenderer when the entire entity model is a PulseLib model.
public class RobotRenderer extends PEntityRenderer<RobotEntity, PEntityRenderState.LivingImpl<RobotEntity>>
{
public RobotRenderer(EntityRendererProvider.Context context)
{
super(context,
PModelData.entity(Identifier.fromNamespaceAndPath("examplemod", "robot")),
PRenderTypes.RenderTypeProvider::trianglesSolid);
}
@Override
public PEntityRenderState.LivingImpl<RobotEntity> createRenderState()
{
return PLibHelper.livingRenderState();
}
}
For LivingEntity subclasses, PEntityRenderer applies vanilla body rotation, sleeping/death/spin transforms, entity scale, and head yaw/pitch for a bone named head.
Render type requirement
PulseLib models are triangle meshes. Use PRenderTypes.RenderTypeProvider:
PRenderTypes.RenderTypeProvider::trianglesSolid
PRenderTypes.RenderTypeProvider::trianglesCutout
PRenderTypes.RenderTypeProvider::trianglesTranslucent
These are the queued variants used by all three renderer classes, including PItemRenderer in GUI display context. Use trianglesInstantTranslucent for direct drawing. Do not pass vanilla entity/block RenderType values unless they use a compatible triangle vertex format and shader setup.
The renderer APIs use 26.1.2 render states and SubmitNodeCollector; the old MultiBufferSource/BlockEntityWithoutLevelRenderer examples do not apply to this branch.