use of net.fabricmc.indigo.renderer.render.TerrainRenderContext 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);
}
}
use of net.fabricmc.indigo.renderer.render.TerrainRenderContext in project fabric by FabricMC.
the class MixinChunkRenderer method hookRebuildChunkHead.
/**
* Save task to renderer, this is the easiest place to capture it.
*/
@Inject(at = @At("HEAD"), method = "rebuildChunk")
private void hookRebuildChunkHead(float float_1, float float_2, float float_3, ChunkRenderTask chunkRenderTask_1, CallbackInfo info) {
if (chunkRenderTask_1 != null) {
TerrainRenderContext renderer = TerrainRenderContext.POOL.get();
renderer.setChunkTask(chunkRenderTask_1);
}
}
Aggregations