use of net.fabricmc.indigo.renderer.accessor.AccessChunkRendererRegion in project fabric by FabricMC.
the class MixinChunkRenderTask method chunkDataHook.
/**
* The block view reference is voided when {@link ChunkRenderTask#getAndInvalidateWorldView()} is called during
* chunk rebuild, but we need it and it is harder to make reliable, non-invasive changes there.
* So we capture the block view before the reference is voided and send it to the renderer. <p>
*
* We also store a reference to the renderer in the view to avoid doing thread-local lookups for each block.
*/
@Inject(at = @At("HEAD"), method = "takeRegion")
private void chunkDataHook(CallbackInfoReturnable<ChunkRendererRegion> info) {
final ChunkRendererRegion blockView = region;
if (blockView != null) {
final TerrainRenderContext renderer = TerrainRenderContext.POOL.get();
renderer.setBlockView(blockView);
((AccessChunkRendererRegion) blockView).fabric_setRenderer(renderer);
}
}
Aggregations