Last active
December 13, 2020 00:40
-
-
Save Haven-King/ba60c1f059b55aec86638028e9f0de66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Environment(EnvType.CLIENT) | |
| public interface BakedChunkSectionRenderer { | |
| ConditionalEvent<ChunkRenderConditionContext, BakedChunkSectionRenderer> EVENT = | |
| new ArrayBackedConditionalEvent<>(listeners -> { | |
| return (context) -> { | |
| ChunkRenderConditionContext conditionContext = new ChunkRenderConditionContext(context.startPos, context.endPos); | |
| for (Pair<Function<ChunkRenderConditionContext, Boolean>, BakedChunkSectionRenderer> pair : listeners) { | |
| if (pair.getLeft().apply(conditionContext)) { | |
| pair.getRight().bake(context); | |
| } | |
| } | |
| }; | |
| }, null); | |
| void bake(ChunkRenderContext context); | |
| class ChunkRenderContext { | |
| public final ChunkRendererRegion chunkRendererRegion; | |
| public final BlockState state; | |
| public final BlockPos pos; | |
| public final Random random; | |
| public final BlockRenderManager blockRenderManager; | |
| public final TerrainRenderContext context; | |
| public final BlockPos endPos; | |
| public final BlockPos startPos; | |
| public final MatrixStack matrixStack; | |
| public ChunkRenderContext(ChunkRendererRegion chunkRendererRegion, BlockState state, BlockRenderManager blockRenderManager, BlockPos startPos, BlockPos endPos, BlockPos pos, Random random, TerrainRenderContext context, MatrixStack matrixStack) { | |
| this.chunkRendererRegion = chunkRendererRegion; | |
| this.state = state; | |
| this.blockRenderManager = blockRenderManager; | |
| this.startPos = startPos; | |
| this.endPos = endPos; | |
| this.pos = pos; | |
| this.random = random; | |
| this.context = context; | |
| this.matrixStack = matrixStack; | |
| } | |
| } | |
| class ChunkRenderConditionContext { | |
| public final BlockPos startPos; | |
| public final BlockPos endPos; | |
| public ChunkRenderConditionContext(BlockPos startPos, BlockPos endPos) { | |
| this.startPos = startPos; | |
| this.endPos = endPos; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment