net.minecraft.client.renderer.chunk.RenderChunk Java Examples
The following examples show how to use
net.minecraft.client.renderer.chunk.RenderChunk.
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: RenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void renderChunkLayer(BlockRenderLayer layer) { if (this.initialized) { for (RenderChunk renderChunk : this.renderChunks) { RenderChunkSchematicList listedrenderchunk = (RenderChunkSchematicList) renderChunk; GlStateManager.pushMatrix(); this.preRenderChunk(renderChunk); GlStateManager.callList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getChunkRenderData())); GlStateManager.popMatrix(); } GlStateManager.resetColor(); this.renderChunks.clear(); } }
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: VboRenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void renderChunkLayer(BlockRenderLayer layer) { if (this.initialized) { for (RenderChunk renderChunk : this.renderChunks) { this.renderBlocks(renderChunk.getVertexBufferByLayer(layer.ordinal()), renderChunk); } OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); GlStateManager.resetColor(); this.renderChunks.clear(); } }
Example #4
Source File: PrePostBlockModelRenderEvent.java From ForgeHax with MIT License | 5 votes |
public PrePostBlockModelRenderEvent( RenderChunk renderChunk, BufferBuilder BufferBuilder, State state, float x, float y, float z) { this(renderChunk, BufferBuilder, state, new Vec3d(x, y, z)); }
Example #5
Source File: Markers.java From ForgeHax with MIT License | 5 votes |
/** * Improve speed by looking up in smaller map */ private Optional<RenderUploader<GeometryTessellator>> getCurrentRenderUploader( RenderChunk optional) { if (uploaders == null) { return Optional.empty(); } RenderUploader<GeometryTessellator> ru = localUploader.get(); return ru == null ? uploaders.get(optional) : Optional.of(ru); }
Example #6
Source File: Markers.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onLoadRenderers(LoadRenderersEvent event) { try { // create new instances of everything vboStartup(); // allocate all space needed for (RenderChunk renderChunk : event.getViewFrustum().renderChunks) { uploaders.register(renderChunk); } } catch (Throwable t) { handleException(t); } }
Example #7
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 5 votes |
public static void onBlockRenderInLoop( RenderChunk renderChunk, Block block, IBlockState state, BlockPos pos) { // faster hook if (HOOK_onBlockRenderInLoop.reportHook()) { for (BlockModelRenderListener listener : Listeners.BLOCK_MODEL_RENDER_LISTENER.getAll()) { listener.onBlockRenderInLoop(renderChunk, block, state, pos); } } }
Example #8
Source File: ChunkRenderDispatcherLitematica.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void uploadDisplayList(BufferBuilder bufferBuilderIn, int list, RenderChunk renderChunk) { GlStateManager.glNewList(list, GL11.GL_COMPILE); GlStateManager.pushMatrix(); //chunkRenderer.multModelviewMatrix(); this.displayListUploader.draw(bufferBuilderIn); GlStateManager.popMatrix(); GlStateManager.glEndList(); }
Example #9
Source File: Uploaders.java From ForgeHax with MIT License | 5 votes |
/** * Register RenderChunk and create new RenderUploader instance for it */ public void register(RenderChunk renderChunk) { RenderUploader<E> uploader = uploaders.get(renderChunk); // if a key for this object already exists, notify the shutdown hook and remove the old entry if (uploader != null && shutdownTask != null) { shutdownTask.accept(uploader); } uploaders.put(renderChunk, supplier.get(this)); }
Example #10
Source File: Uploaders.java From ForgeHax with MIT License | 5 votes |
/** * Unregister RenderChunk */ public void unregister(RenderChunk renderChunk) { RenderUploader<E> uploader = uploaders.get(renderChunk); // if a key for this object already exists, notify the shutdown hook and remove the old entry if (uploader != null && shutdownTask != null) { shutdownTask.accept(uploader); uploaders.remove(renderChunk); } }
Example #11
Source File: VboRenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderOverlay(VertexBuffer vertexBuffer, RenderChunk renderChunk, int glMode) { GlStateManager.pushMatrix(); this.preRenderChunk(renderChunk); //renderChunk.multModelviewMatrix(); vertexBuffer.bindBuffer(); this.setupArrayPointersOverlay(); vertexBuffer.drawArrays(glMode); GlStateManager.popMatrix(); }
Example #12
Source File: VboRenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderBlocks(VertexBuffer vertexBuffer, RenderChunk renderChunk) { GlStateManager.pushMatrix(); this.preRenderChunk(renderChunk); //renderChunk.multModelviewMatrix(); vertexBuffer.bindBuffer(); this.setupArrayPointersBlocks(); vertexBuffer.drawArrays(GL11.GL_QUADS); GlStateManager.popMatrix(); }
Example #13
Source File: MixinGuiOverlayDebug.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void renderOldDebugInfoLeft() { FontRenderer fontRendererObj = mc.fontRendererObj; fontRendererObj.drawStringWithShadow("Minecraft 1.8.9 (" + Minecraft.getDebugFPS() + " fps, " + RenderChunk.renderChunksUpdated + " chunk updates)", 2, 2, -1); fontRendererObj.drawStringWithShadow(mc.renderGlobal.getDebugInfoRenders(), 2, 12, -1); fontRendererObj.drawStringWithShadow(mc.renderGlobal.getDebugInfoEntities(), 2, 22, -1); fontRendererObj.drawStringWithShadow("P: " + mc.effectRenderer.getStatistics() + ". T: " + mc.theWorld.getDebugLoadedEntities(), 2, 32, -1); fontRendererObj.drawStringWithShadow(mc.theWorld.getProviderName(), 2, 42, -1); int posX = MathHelper.floor_double(mc.thePlayer.posX); int posY = MathHelper.floor_double(mc.thePlayer.posY); int posZ = MathHelper.floor_double(mc.thePlayer.posZ); fontRendererObj.drawStringWithShadow(String.format("x: %.5f (%d) // c: %d (%d)", mc.thePlayer.posX, posX, posX >> 4, posX & 15), 2, 64, -1); fontRendererObj.drawStringWithShadow(String.format("y: %.3f (feet pos, %.3f eyes pos)", mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posY), 2, 72, -1); Entity entity = mc.getRenderViewEntity(); EnumFacing enumfacing = entity.getHorizontalFacing(); fontRendererObj.drawStringWithShadow(String.format("z: %.5f (%d) // c: %d (%d)", mc.thePlayer.posZ, posZ, posZ >> 4, posZ & 15), 2, 80, -1); int yaw = MathHelper.floor_double((double) (mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; fontRendererObj.drawStringWithShadow("f: " + yaw + " (" + enumfacing + ") / " + MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw), 2, 88, -1); if (mc.theWorld != null && !mc.theWorld.isAirBlock(new BlockPos(posX, posY, posZ))) { Chunk chunk = mc.theWorld.getChunkFromBlockCoords(new BlockPos(posX, posY, posZ)); fontRendererObj.drawStringWithShadow("lc: " + (chunk.getTopFilledSegment() + 15) + " b: " + chunk.getBiome(new BlockPos(posX & 15, 64, posZ & 15), mc.theWorld.getWorldChunkManager()).biomeName + " bl: " + chunk.getBlockLightOpacity(new BlockPos(posX & 15, posY, posZ & 15)) + " sl: " + chunk.getBlockLightOpacity( new BlockPos(posX & 15, posY, posZ & 15)) + " rl: " + chunk.getBlockLightOpacity(new BlockPos(posX & 15, posY, posZ & 15)), 2, 96, -1); } fontRendererObj.drawStringWithShadow(String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", mc.thePlayer.capabilities.getWalkSpeed(), mc.thePlayer.capabilities.getFlySpeed(), mc.thePlayer.onGround, mc.theWorld.getHeight()), 2, 104, -1); if (mc.entityRenderer != null && mc.entityRenderer.isShaderActive()) { fontRendererObj.drawStringWithShadow(String.format("shader: %s", mc.entityRenderer.getShaderGroup().getShaderGroupName()), 2, 112, -1); } }
Example #14
Source File: AnimationHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public void setPosition(RenderChunk rc, BlockPos bp) { if (!ChunkAnimatorConfig.enabled) return; if (Minecraft.getMinecraft().thePlayer != null) { boolean flag = true; BlockPos zeroedPlayerPosition = Minecraft.getMinecraft().thePlayer.getPosition(); zeroedPlayerPosition = zeroedPlayerPosition.add(0, -zeroedPlayerPosition.getY(), 0); BlockPos zeroedCenteredChunkPos = bp.add(8, -bp.getY(), 8); if (ChunkAnimatorConfig.disableAroundPlayer) { flag = zeroedPlayerPosition.distanceSq(zeroedCenteredChunkPos) > (64 * 64); } if (flag) { EnumFacing chunkFacing = null; if (ChunkAnimatorConfig.mode.equals("From sides")) { Vec3i dif = zeroedPlayerPosition.subtract(zeroedCenteredChunkPos); int difX = Math.abs(dif.getX()); int difZ = Math.abs(dif.getZ()); chunkFacing = getFacing(dif, difX, difZ); } AnimationData animationData = new AnimationData(-1L, chunkFacing); timeStamps.put(rc, animationData); } } }
Example #15
Source File: PrePostBlockModelRenderEvent.java From ForgeHax with MIT License | 5 votes |
public PrePostBlockModelRenderEvent( RenderChunk renderChunk, BufferBuilder BufferBuilder, State state, Vec3d pos) { this.renderChunk = renderChunk; this.buffer = BufferBuilder; this.state = state; this.pos = pos; }
Example #16
Source File: ChunkUploadedEvent.java From ForgeHax with MIT License | 4 votes |
public ChunkUploadedEvent(RenderChunk renderChunk, BufferBuilder BufferBuilder) { this.renderChunk = renderChunk; this.buffer = BufferBuilder; }
Example #17
Source File: ChunkUploadedEvent.java From ForgeHax with MIT License | 4 votes |
public RenderChunk getRenderChunk() { return renderChunk; }
Example #18
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 4 votes |
public static void onPreBuildChunk(RenderChunk renderChunk) { if (HOOK_onPreBuildChunk.reportHook()) { MinecraftForge.EVENT_BUS.post(new BuildChunkEvent.Pre(renderChunk)); } }
Example #19
Source File: PrePostBlockModelRenderEvent.java From ForgeHax with MIT License | 4 votes |
public RenderChunk getRenderChunk() { return renderChunk; }
Example #20
Source File: RenderUploader.java From ForgeHax with MIT License | 4 votes |
public boolean isCorrectRegion(RenderChunk chunk) { return region != null && region.equals(chunk.getPosition()); }
Example #21
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 4 votes |
public static void onPostBuildChunk(RenderChunk renderChunk) { // i couldn't place a post block render hook within the if label so I have to do this if (HOOK_onPostBuildChunk.reportHook()) { MinecraftForge.EVENT_BUS.post(new BuildChunkEvent.Post(renderChunk)); } }
Example #22
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 4 votes |
public static void onDeleteGlResources(RenderChunk renderChunk) { if (HOOK_onDeleteGlResources.reportHook()) { MinecraftForge.EVENT_BUS.post(new DeleteGlResourcesEvent(renderChunk)); } }
Example #23
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 4 votes |
public static void onAddRenderChunk(RenderChunk renderChunk, BlockRenderLayer layer) { if (HOOK_onAddRenderChunk.reportHook()) { MinecraftForge.EVENT_BUS.post(new AddRenderChunkEvent(renderChunk, layer)); } }
Example #24
Source File: ForgeHaxHooks.java From ForgeHax with MIT License | 4 votes |
public static void onChunkUploaded(RenderChunk chunk, BufferBuilder buffer) { if (HOOK_onChunkUploaded.reportHook()) { MinecraftForge.EVENT_BUS.post(new ChunkUploadedEvent(chunk, buffer)); } }
Example #25
Source File: Markers.java From ForgeHax with MIT License | 4 votes |
private static void handleException(RenderChunk renderChunk, Throwable t) { // throwable.printStackTrace(); Helper.getLog().error(t.toString()); t.printStackTrace(); }
Example #26
Source File: RenderUploader.java From ForgeHax with MIT License | 4 votes |
public void setRegion(RenderChunk chunk) { region = new BlockPos(chunk.getPosition()); // copy because RenderChunk.position is mutable }
Example #27
Source File: DeleteGlResourcesEvent.java From ForgeHax with MIT License | 4 votes |
public DeleteGlResourcesEvent(RenderChunk renderChunk) { this.renderChunk = renderChunk; }
Example #28
Source File: Uploaders.java From ForgeHax with MIT License | 4 votes |
public Optional<RenderUploader<E>> get(RenderChunk renderChunk) { return Optional.ofNullable(uploaders.get(renderChunk)); }
Example #29
Source File: Uploaders.java From ForgeHax with MIT License | 4 votes |
public void computeIfPresent(RenderChunk renderChunk, final Consumer<RenderUploader<E>> task) { RenderUploader<E> uploader = uploaders.get(renderChunk); if (uploader != null) { task.accept(uploader); } }
Example #30
Source File: Uploaders.java From ForgeHax with MIT License | 4 votes |
public void forEach(BiConsumer<RenderChunk, RenderUploader<E>> action) { uploaders.forEach(action); }