mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-30 17:06:56 +01:00
Optimize lighting checks
Also - Set null layer after rendering contraption
This commit is contained in:
parent
6c1c7a10d9
commit
dac9010f20
2 changed files with 8 additions and 3 deletions
|
@ -175,20 +175,22 @@ public class RenderedContraption {
|
|||
|
||||
for (Template.BlockInfo info : c.getBlocks()
|
||||
.values())
|
||||
renderWorld.setBlockState(info.pos, info.state);
|
||||
// Skip individual lighting updates to prevent lag with large contraptions
|
||||
renderWorld.setBlockState(info.pos, info.state, 128);
|
||||
|
||||
renderWorld.updateLightSources();
|
||||
renderWorld.lighter.tick(Integer.MAX_VALUE, false, false);
|
||||
|
||||
return renderWorld;
|
||||
}
|
||||
|
||||
private static BufferBuilder buildStructure(PlacementSimulationWorld renderWorld, Contraption c, RenderType layer) {
|
||||
ForgeHooksClient.setRenderLayer(layer);
|
||||
MatrixStack ms = new MatrixStack();
|
||||
Random random = new Random();
|
||||
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
|
||||
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
|
||||
ForgeHooksClient.setRenderLayer(layer);
|
||||
BlockModelRenderer.enableCache();
|
||||
for (Template.BlockInfo info : c.getBlocks()
|
||||
.values()) {
|
||||
|
@ -208,6 +210,7 @@ public class RenderedContraption {
|
|||
ms.pop();
|
||||
}
|
||||
BlockModelRenderer.disableCache();
|
||||
ForgeHooksClient.setRenderLayer(null);
|
||||
|
||||
builder.finishDrawing();
|
||||
return builder;
|
||||
|
|
|
@ -73,7 +73,9 @@ public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelW
|
|||
lighter.updateSectionStatus(sectionPos, false);
|
||||
}
|
||||
|
||||
lighter.checkBlock(pos);
|
||||
if ((flags & 128) == 0) {
|
||||
lighter.checkBlock(pos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue