net.minecraft.client.renderer.chunk.CompiledChunk Java Examples
The following examples show how to use
net.minecraft.client.renderer.chunk.CompiledChunk.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
private void addTileEntity(BlockPos pos, CompiledChunk compiledChunk, Set<TileEntity> tileEntities) { TileEntity te = this.schematicWorldView.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); if (te != null) { TileEntitySpecialRenderer<TileEntity> tesr = TileEntityRendererDispatcher.instance.<TileEntity>getRenderer(te); if (tesr != null) { compiledChunk.addTileEntity(te); if (tesr.isGlobalRenderer(te)) { tileEntities.add(te); } } } }
Example #2
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected int getRenderedChunks() { int count = 0; for (RenderChunk renderChunk : this.renderInfos) { CompiledChunk compiledchunk = renderChunk.compiledChunk; if (compiledchunk != CompiledChunk.DUMMY && compiledchunk.isEmpty() == false) { ++count; } } return count; }
Example #3
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderBlockOverlay(OverlayRenderType type) { this.world.profiler.startSection("overlay_" + type.name()); this.world.profiler.startSection("filter_empty"); for (int i = this.renderInfos.size() - 1; i >= 0; --i) { RenderChunkSchematicVbo renderChunk = this.renderInfos.get(i); if (renderChunk.getChunkRenderData() != CompiledChunk.DUMMY && renderChunk.hasOverlay()) { CompiledChunkSchematic compiledChunk = renderChunk.getChunkRenderData(); if (compiledChunk.isOverlayTypeEmpty(type) == false) { this.renderContainer.addOverlayChunk(renderChunk); } } } this.world.profiler.endStartSection("render"); this.renderBlockOverlayBuffers(type); this.world.profiler.endSection(); this.world.profiler.endSection(); }
Example #4
Source File: ChunkRenderDispatcherLitematica.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public ListenableFuture<Object> uploadChunkBlocks(final BlockRenderLayer layer, final BufferBuilder buffer, final RenderChunkSchematicVbo renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { //if (GuiBase.isCtrlDown()) System.out.printf("uploadChunkBlocks()\n"); if (OpenGlHelper.useVbo()) { this.uploadVertexBuffer(buffer, renderChunk.getVertexBufferByLayer(layer.ordinal())); } else { this.uploadDisplayList(buffer, ((RenderChunkSchematicList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); } buffer.setTranslation(0.0D, 0.0D, 0.0D); return Futures.<Object>immediateFuture(null); } else { ListenableFutureTask<Object> futureTask = ListenableFutureTask.<Object>create(new Runnable() { @Override public void run() { ChunkRenderDispatcherLitematica.this.uploadChunkBlocks(layer, buffer, renderChunk, compiledChunk, distanceSq); } }, null); synchronized (this.queueChunkUploads) { this.queueChunkUploads.add(new ChunkRenderDispatcherLitematica.PendingUpload(futureTask, distanceSq)); return futureTask; } } }
Example #5
Source File: MixinBlockFluidRenderer.java From VanillaFix with MIT License | 5 votes |
/** * @reason Adds liquid textures to the set of visible textures in the compiled chunk. Note * that this is necessary only for liquid textures, since Forge liquids are rendered by the * normal block rendering code. */ @ModifyVariable(method = "renderFluid", at = @At(value = "CONSTANT", args = "floatValue=0.001", ordinal = 1), ordinal = 0) private TextureAtlasSprite afterTextureDetermined(TextureAtlasSprite texture) { CompiledChunk compiledChunk = TemporaryStorage.currentCompiledChunk.get(); if (compiledChunk != null) { ((IPatchedCompiledChunk) compiledChunk).getVisibleTextures().add(texture); } else { // Called from non-chunk render thread. Unfortunately, the best we can do // is assume it's only going to be used once: ((IPatchedTextureAtlasSprite) texture).markNeedsAnimationUpdate(); } return texture; }
Example #6
Source File: RenderChunkSchematicList.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
public int getDisplayList(BlockRenderLayer layer, CompiledChunk compiledChunk) { return compiledChunk.isLayerEmpty(layer) == false ? this.baseDisplayList + layer.ordinal() : -1; }
Example #7
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
public int renderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, Entity entityIn) { this.world.profiler.startSection("render_block_layer_" + blockLayerIn); RenderUtils.disableItemLighting(); if (blockLayerIn == BlockRenderLayer.TRANSLUCENT) { this.world.profiler.startSection("translucent_sort"); double diffX = entityIn.posX - this.prevRenderSortX; double diffY = entityIn.posY - this.prevRenderSortY; double diffZ = entityIn.posZ - this.prevRenderSortZ; if (diffX * diffX + diffY * diffY + diffZ * diffZ > 1.0D) { this.prevRenderSortX = entityIn.posX; this.prevRenderSortY = entityIn.posY; this.prevRenderSortZ = entityIn.posZ; int i = 0; for (RenderChunkSchematicVbo renderChunk : this.renderInfos) { if ((renderChunk.getChunkRenderData().isLayerStarted(blockLayerIn) || (renderChunk.getChunkRenderData() != CompiledChunk.DUMMY && renderChunk.hasOverlay())) && i++ < 15) { this.renderDispatcher.updateTransparencyLater(renderChunk); } } } this.world.profiler.endSection(); } this.world.profiler.startSection("filter_empty"); boolean reverse = blockLayerIn == BlockRenderLayer.TRANSLUCENT; int startIndex = reverse ? this.renderInfos.size() - 1 : 0; int stopIndex = reverse ? -1 : this.renderInfos.size(); int increment = reverse ? -1 : 1; int count = 0; for (int i = startIndex; i != stopIndex; i += increment) { RenderChunkSchematicVbo renderchunk = this.renderInfos.get(i); if (renderchunk.getChunkRenderData().isLayerEmpty(blockLayerIn) == false) { ++count; this.renderContainer.addRenderChunk(renderchunk, blockLayerIn); } } this.world.profiler.endStartSection("render"); this.renderBlockLayer(blockLayerIn); this.world.profiler.endSection(); this.world.profiler.endSection(); return count; }
Example #8
Source File: ChunkCompileTaskGeneratorSchematic.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
public CompiledChunk getCompiledChunk() { return this.compiledChunk; }
Example #9
Source File: ChunkCompileTaskGeneratorSchematic.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
public void setCompiledChunk(CompiledChunk compiledChunkIn) { this.compiledChunk = compiledChunkIn; }
Example #10
Source File: MixinRenderChunk.java From VanillaFix with MIT License | 4 votes |
/** * @reason Store the chunk currently being rebuild in TemporaryStorage.currentCompiledChunk * by thread ID (there are multiple chunk renderer threads working at once). */ @Inject(method = "rebuildChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/chunk/CompiledChunk;<init>()V", ordinal = 0, shift = At.Shift.BY, by = 2), locals = LocalCapture.CAPTURE_FAILHARD) private void onRebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator, CallbackInfo ci, CompiledChunk compiledChunk) { TemporaryStorage.currentCompiledChunk.set(compiledChunk); }
Example #11
Source File: Uploaders.java From ForgeHax with MIT License | 4 votes |
public static boolean isDummy(RenderChunk chunk) { return chunk != null && chunk.getCompiledChunk() == CompiledChunk.DUMMY; }