Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RenderGlobal render = Minecraft.getMinecraft().renderGlobal;
- /* Getting private fields from RenderGlobal using reflection, safest way,
- * I guess */
- Field frustumField = null;
- Field chunkyField = null;
- for (Field field : render.getClass().getDeclaredFields())
- {
- if (chunkyField == null && field.getType().equals(ChunkRenderDispatcher.class))
- {
- chunkyField = field;
- chunkyField.setAccessible(true);
- }
- if (frustumField == null && field.getType().equals(ViewFrustum.class))
- {
- frustumField = field;
- frustumField.setAccessible(true);
- }
- if (chunkyField != null && frustumField != null)
- {
- break;
- }
- }
- /* Forcing all possible chunks to be loaded */
- if (chunkyField != null && frustumField != null)
- {
- try
- {
- ChunkRenderDispatcher chunks = (ChunkRenderDispatcher) chunkyField.get(render);
- ViewFrustum frustum = (ViewFrustum) frustumField.get(render);
- for (RenderChunk chunk : frustum.renderChunks)
- {
- /* Unloaded chunks seem to have compiled chunk field default to
- * CompiledChunk.DUMMY */
- boolean isDummy = chunk.getCompiledChunk() == CompiledChunk.DUMMY;
- if (isDummy)
- {
- chunks.updateChunkNow(chunk);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement