Interface RenderContext
Only the renderer should implement or extend this interface.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionConsumer<net.minecraft.client.render.model.BakedModel>Fabric causes vanilla baked models to send themselves via this interface.Returns aQuadEmitterinstance that emits directly to the render buffer.Used by models to send vertex data previously baked viaMeshBuilder.voidRemoves the transformation added by the last call topushTransform(QuadTransform).voidpushTransform(RenderContext.QuadTransform transform) Causes all models/quads/meshes sent to this consumer to be transformed by the providedRenderContext.QuadTransformthat edits each quad before buffering.
-
Method Details
-
meshConsumer
Used by models to send vertex data previously baked viaMeshBuilder. The fastest option and preferred whenever feasible. -
fallbackConsumer
Consumer<net.minecraft.client.render.model.BakedModel> fallbackConsumer()Fabric causes vanilla baked models to send themselves via this interface. Can also be used by compound models that contain a mix of vanilla baked models, packaged quads and/or dynamic elements. -
getEmitter
QuadEmitter getEmitter()Returns aQuadEmitterinstance that emits directly to the render buffer. It remains necessary to callQuadEmitter.emit()to output the quad.This method will always be less performant than passing pre-baked meshes via
meshConsumer(). It should be used sparingly for model components that demand it - text, icons, dynamic indicators, or other elements that vary too much for static baking to be feasible.Calling this method invalidates any
QuadEmitterreturned earlier. Will be threadlocal/re-used - do not retain references. -
pushTransform
Causes all models/quads/meshes sent to this consumer to be transformed by the providedRenderContext.QuadTransformthat edits each quad before buffering. Quads in the mesh will be passed to theRenderContext.QuadTransformfor modification before offsets, face culling or lighting are applied. Meant for animation and mesh customization.You MUST call
popTransform()after model is done outputting quads.More than one transformer can be added to the context. Transformers are applied in reverse order. (Last pushed is applied first.)
Meshes are never mutated by the transformer - only buffered quads. This ensures thread-safe use of meshes/models across multiple chunk builders.
-
popTransform
void popTransform()Removes the transformation added by the last call topushTransform(QuadTransform). MUST be called before exiting fromFabricBakedModel.emit... methods.
-