Class LevelRenderEvents
LevelRenderer.renderLevel(GraphicsResourceAllocator, DeltaTracker, boolean, CameraRenderState, Matrix4f, GpuBufferSlice, Vector4f, boolean, ChunkSectionsToRender)
without adding complicated and conflict-prone injections there. Using these events also enables 3rd-party renderers
that make large-scale rendering changes to maintain compatibility by calling any broken event invokers directly.
These events can be separated into two categories, the "extraction" events and the "drawing" events, reflecting the respective vanilla phases. All data needed for rendering should be prepared in the "extraction" phase and drawn to the frame buffer during the "drawing" phase. All "extraction" events have the suffix "Extraction". All events without the "Extraction" suffix are "drawing" events. All "drawing" events support OpenGL calls.
To attach modded data to vanilla render states, see FabricRenderState.
Only attach the minimum data needed for rendering. Do not attach objects that are not thread-safe such as ClientLevel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Event<LevelRenderEvents.AfterBlockOutlineExtraction> Called after the block outline render state is extracted, before it is drawn.static final Event<LevelRenderEvents.AfterOpaqueTerrain> Called after opaque terrain is drawn to the appropriate framebuffers, and before any submit nodes are added to the submit node storage.static final Event<LevelRenderEvents.AfterSolidFeatures> Called after the solid geometry of submits collected from entities, block entities, and particles are drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.AfterTranslucentFeatures> Called after the translucent geometry of submits collected from entities and block entities are drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.AfterTranslucentTerrain> Called after terrain, entities, block entities, solid particles, overlays, and gizmos are drawn to the appropriate framebuffers, and before translucent particles are drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.BeforeBlockOutline> Called after block outline render checks are made and before the default block outline is drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.BeforeGizmos> Called after all geometry of submits collected from entities, block entities, and particles (except translucent particle geometry), the block breaking overlay, and the block outline for solid blocks are drawn to the appropriate framebuffers, and before gizmos are collected.static final Event<LevelRenderEvents.BeforeTranslucentTerrain> Called after opaque terrain, entities, block entities, solid particles, overlays, and gizmos are drawn to the appropriate framebuffers, and before translucent terrain and translucent particles are drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.CollectSubmits> Called after opaque terrain is drawn to the appropriate framebuffers and all submit nodes from entities, block entities, and particles are added to the submit node storage, and before any submit geometry is drawn to the appropriate framebuffers.static final Event<LevelRenderEvents.EndExtraction> Called after all render states are extracted, before any are drawn.static final Event<LevelRenderEvents.EndMain> Called at the end of the main render pass, after terrain, entities, block entities, and particles are drawn to the appropriate framebuffers, and before clouds, weather, and late debug are drawn to the appropriate framebuffers and before fabulous translucent framebuffers are combined.static final Event<LevelRenderEvents.StartMain> Called at the start of the main pass, after the sky is drawn to the appropriate framebuffers and all chunks to be rendered are uploaded to GPU, and before any chunks are drawn to the appropriate framebuffers. -
Method Summary
-
Field Details
-
AFTER_BLOCK_OUTLINE_EXTRACTION
public static final Event<LevelRenderEvents.AfterBlockOutlineExtraction> AFTER_BLOCK_OUTLINE_EXTRACTIONCalled after the block outline render state is extracted, before it is drawn. Can optionally cancel the default rendering by setting the outline render state to null but all handlers for this event will always be called.Use this to extract custom data needed when decorating or replacing the default block outline rendering for specific modded blocks or when normally, the block outline would not be extracted to be rendered. Normally, outline rendering will not happen for entities, fluids, or other game objects that do not register a block-type hit.
To attach modded data to vanilla render states, see
FabricRenderState. Only attach the minimum data needed for rendering. Do not attach objects that are not thread-safe such asClientLevel.Setting the outline render state to null by any event subscriber will cancel the default block outline render and suppress the
BEFORE_BLOCK_OUTLINEevent. This has no effect on other subscribers to this event - all subscribers will always be called. Setting outline render state to null here is appropriate when there is still a valid block hit (with a fluid, for example) and you don't want the block outline render to appear.This event should NOT be used for general-purpose replacement of the default block outline rendering because it will interfere with mod-specific renders. Mods that replace the default block outline for specific blocks should instead subscribe to
BEFORE_BLOCK_OUTLINE. -
END_EXTRACTION
Called after all render states are extracted, before any are drawn. Use this to extract general custom data needed for rendering.To attach modded data to vanilla render states, see
FabricRenderState. Only attach the minimum data needed for rendering. Do not attach objects that are not thread-safe such asClientLevel. -
START_MAIN
Called at the start of the main pass, after the sky is drawn to the appropriate framebuffers and all chunks to be rendered are uploaded to GPU, and before any chunks are drawn to the appropriate framebuffers. -
AFTER_OPAQUE_TERRAIN
Called after opaque terrain is drawn to the appropriate framebuffers, and before any submit nodes are added to the submit node storage.Use this event to render additional opaque terrain-like geometry.
-
COLLECT_SUBMITS
Called after opaque terrain is drawn to the appropriate framebuffers and all submit nodes from entities, block entities, and particles are added to the submit node storage, and before any submit geometry is drawn to the appropriate framebuffers.Use this event to add additional submits to
LevelRenderContext.submitNodeCollector(). -
AFTER_SOLID_FEATURES
Called after the solid geometry of submits collected from entities, block entities, and particles are drawn to the appropriate framebuffers. -
AFTER_TRANSLUCENT_FEATURES
Called after the translucent geometry of submits collected from entities and block entities are drawn to the appropriate framebuffers. Note that this excludes translucent particle geometry, which is rendered much later. -
BEFORE_BLOCK_OUTLINE
Called after block outline render checks are made and before the default block outline is drawn to the appropriate framebuffers. This will NOT be called if the default outline render state was set to null inAFTER_BLOCK_OUTLINE_EXTRACTION.Use this to replace the default block outline rendering for specific blocks that need special outline rendering or to add information that doesn't replace the block outline. Subscribers cannot affect each other or detect if another subscriber is also handling a specific block. If two subscribers render for the same block, both renders will appear.
Returning false from any event subscriber will cancel the default block outline render. This has no effect on other subscribers to this event - all subscribers will always be called. Canceling is appropriate when the subscriber replacing the default block outline render for a specific block.
-
BEFORE_GIZMOS
Called after all geometry of submits collected from entities, block entities, and particles (except translucent particle geometry), the block breaking overlay, and the block outline for solid blocks are drawn to the appropriate framebuffers, and before gizmos are collected. -
BEFORE_TRANSLUCENT_TERRAIN
Called after opaque terrain, entities, block entities, solid particles, overlays, and gizmos are drawn to the appropriate framebuffers, and before translucent terrain and translucent particles are drawn to the appropriate framebuffers. -
AFTER_TRANSLUCENT_TERRAIN
Called after terrain, entities, block entities, solid particles, overlays, and gizmos are drawn to the appropriate framebuffers, and before translucent particles are drawn to the appropriate framebuffers.Use this event to render additional translucent terrain-like geometry.
-
END_MAIN
Called at the end of the main render pass, after terrain, entities, block entities, and particles are drawn to the appropriate framebuffers, and before clouds, weather, and late debug are drawn to the appropriate framebuffers and before fabulous translucent framebuffers are combined.
-