Skip to content

API reference Obsidian.API.Client

IBlockEntityRenderer interface

Code that draws a mod's block entities each frame, like vanilla's BlockEntityRenderer.render: for animations BlockEntityRendererProperties.Provider's parts can't describe, such as ones following state the block entity keeps on the client. Give it as BlockEntityRendererProperties.Renderer.

public interface IBlockEntityRenderer

In Obsidian.API.Client.

Methods

Render(BlockEntity, float, IBlockEntityRenderBuffer)

void Render(BlockEntity blockEntity, float partialTick, IBlockEntityRenderBuffer buffer);

Draws a block entity into buffer.

Parameters

blockEntity
The mod's live client instance; cast it to the mod's class.
partialTick
How far the frame is between the last client tick and the next, from 0 to 1.
buffer
What the frame draws the block entity's parts with.

Remarks

It runs each frame for each of the type's block entities within 64 blocks of the camera and in view, on the client's game thread inside a call into the mod. That's the thread BlockEntity.ClientTick runs on, so it reads what ticks keep in the block entity's fields without locking, and interpolates between the last two ticks with partialTick. A block entity is drawn from its first client tick on, once its live instance exists.

Keep it short and free of allocations, as the frame waits for it. If it throws, the error is logged, what it drew that frame is dropped, and it isn't called for the block entity again until its next update.

On this page