emitBlockQuads

void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context)

This method will be called during chunk rebuilds to generate both the static anddynamic portions of a block model when the model implements this interface and isVanillaAdapter returns false.

During chunk rebuild, this method will always be called exactly one time per blockposition, irrespective of which or how many faces or block render layers are includedin the model. Models must output all quads/meshes in a single pass.

Also called to render block models outside of chunk rebuild or block entity rendering.Typically this happens when the block is being rendered as an entity, not as a block placed in the world.Currently this happens for falling blocks and blocks being pushed by a piston, but renderersshould invoke this for all calls to render that occur outside of chunk rebuilds to allow for features added by mods, unless isVanillaAdapter returns true.

Outside of chunk rebuilds, this method will be called every frame. Model implementations shouldrely on pre-baked meshes as much as possible and keep transformation to a minimum. The providedblock position may be the nearest block position and not actual. For this reason, neighborstate lookups are best avoided or will require special handling. Block entity lookups arelikely to fail and/or give meaningless results.

In all cases, renderer will handle face occlusion and filter quads on faces obscured byneighboring blocks (if appropriate). Models only need to consider "sides" to theextent the model is driven by connection with neighbor blocks or other world state.

Note: with getQuads, the randomparameter is normally initialized with the same seed prior to each face layer.Model authors should note this method is called only once per block, and call the providedRandom supplier multiple times if re-seeding is necessary. For wrapped vanilla baked models,it will probably be easier to use fallbackConsumer which handlesre-seeding per face automatically.

Parameters

blockView

Access to world state. Using getBlockEntityRenderAttachment toretrieve block entity state unless thread safety can be guaranteed.param safeBlockEntityAccessor Thread-safe access to block entity data

state

Block state for model being rendered.

pos

Position of block for model being rendered.

randomSupplier

Random object seeded per vanilla conventions. Call multiple times to re-seed.Will not be thread-safe. Do not cache or retain a reference.

context

Accepts model output.

Sources

jvm source
Link copied to clipboard