public LoadRenderersEvent(ViewFrustum viewFrustum, ChunkRenderDispatcher renderDispatcher) { this.viewFrustum = viewFrustum; this.renderDispatcher = renderDispatcher; }
public ChunkRenderDispatcher getRenderDispatcher() { return renderDispatcher; }
/** * Loads all the renderers and sets up the basic settings usage */ public void loadRenderers() { if (this.theWorld != null) { if (this.renderDispatcher == null) { this.renderDispatcher = new ChunkRenderDispatcher(); } this.displayListEntitiesDirty = true; Blocks.LEAVES.setGraphicsLevel(Config.isTreesFancy()); Blocks.LEAVES2.setGraphicsLevel(Config.isTreesFancy()); BlockModelRenderer.updateAoLightValue(); renderInfoCache.clear(); if (Config.isDynamicLights()) { DynamicLights.clear(); } this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; this.renderDistance = this.renderDistanceChunks * 16; this.renderDistanceSq = this.renderDistance * this.renderDistance; boolean flag = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); if (flag && !this.vboEnabled) { this.renderContainer = new RenderList(); this.renderChunkFactory = new ListChunkFactory(); } else if (!flag && this.vboEnabled) { this.renderContainer = new VboRenderList(); this.renderChunkFactory = new VboChunkFactory(); } if (flag != this.vboEnabled) { this.generateStars(); this.generateSky(); this.generateSky2(); } if (this.viewFrustum != null) { this.viewFrustum.deleteGlResources(); } this.stopChunkUpdates(); synchronized (this.setTileEntities) { this.setTileEntities.clear(); } this.viewFrustum = new ViewFrustum(this.theWorld, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); if (this.theWorld != null) { Entity entity = this.mc.getRenderViewEntity(); if (entity != null) { this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ); } } this.renderEntitiesStartupCounter = 2; } }
/** * Loads all the renderers and sets up the basic settings usage */ public void loadRenderers() { if (this.theWorld != null) { if (this.renderDispatcher == null) { this.renderDispatcher = new ChunkRenderDispatcher(); } this.displayListEntitiesDirty = true; Blocks.LEAVES.setGraphicsLevel(this.mc.gameSettings.fancyGraphics); Blocks.LEAVES2.setGraphicsLevel(this.mc.gameSettings.fancyGraphics); this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; boolean flag = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); if (flag && !this.vboEnabled) { this.renderContainer = new RenderList(); this.renderChunkFactory = new ListChunkFactory(); } else if (!flag && this.vboEnabled) { this.renderContainer = new VboRenderList(); this.renderChunkFactory = new VboChunkFactory(); } if (flag != this.vboEnabled) { this.generateStars(); this.generateSky(); this.generateSky2(); } if (this.viewFrustum != null) { this.viewFrustum.deleteGlResources(); } this.stopChunkUpdates(); synchronized (this.setTileEntities) { this.setTileEntities.clear(); } this.viewFrustum = new ViewFrustum(this.theWorld, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); if (this.theWorld != null) { Entity entity = this.mc.getRenderViewEntity(); if (entity != null) { this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ); } } this.renderEntitiesStartupCounter = 2; } }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { RenderGlobal render = Minecraft.getMinecraft().renderGlobal; Field frustumField = null; Field chunkyField = null; /* Find all fields */ 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; } } /* Force chunk loading */ if (chunkyField != null && frustumField != null) { try { ChunkRenderDispatcher chunks = (ChunkRenderDispatcher) chunkyField.get(render); ViewFrustum frustum = (ViewFrustum) frustumField.get(render); for (RenderChunk chunk : frustum.renderChunks) { boolean isDummy = chunk.getCompiledChunk() == CompiledChunk.DUMMY; if (isDummy) { chunks.updateChunkNow(chunk); } } L10n.info(sender, "commands.load_chunks"); } catch (Exception e) { e.printStackTrace(); L10n.error(sender, "commands.load_chunks"); } } }
@Override public void loadRenderers() { if(this.world != null) { if(this.renderDispatcher == null) { this.renderDispatcher = new ChunkRenderDispatcher(); } this.displayListEntitiesDirty = true; Blocks.LEAVES.setGraphicsLevel(this.mc.gameSettings.fancyGraphics); Blocks.LEAVES2.setGraphicsLevel(this.mc.gameSettings.fancyGraphics); this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; boolean flag = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); if(flag && !this.vboEnabled) { this.renderContainer = new RenderList(); this.renderChunkFactory = new ListChunkFactory(); } else if(!flag && this.vboEnabled) { this.renderContainer = new VboRenderList(); this.renderChunkFactory = new VboChunkFactory(); } if(flag != this.vboEnabled) { this.generateStars(); this.generateSky(); this.generateSky2(); } cleanViewFrustums(); this.stopChunkUpdates(); synchronized(this.setTileEntities) { this.setTileEntities.clear(); } this.renderEntitiesStartupCounter = 2; } }