mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 09:13:42 +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()
|
for (Template.BlockInfo info : c.getBlocks()
|
||||||
.values())
|
.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);
|
renderWorld.lighter.tick(Integer.MAX_VALUE, false, false);
|
||||||
|
|
||||||
return renderWorld;
|
return renderWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BufferBuilder buildStructure(PlacementSimulationWorld renderWorld, Contraption c, RenderType layer) {
|
private static BufferBuilder buildStructure(PlacementSimulationWorld renderWorld, Contraption c, RenderType layer) {
|
||||||
ForgeHooksClient.setRenderLayer(layer);
|
|
||||||
MatrixStack ms = new MatrixStack();
|
MatrixStack ms = new MatrixStack();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
|
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
|
||||||
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||||
|
|
||||||
|
ForgeHooksClient.setRenderLayer(layer);
|
||||||
BlockModelRenderer.enableCache();
|
BlockModelRenderer.enableCache();
|
||||||
for (Template.BlockInfo info : c.getBlocks()
|
for (Template.BlockInfo info : c.getBlocks()
|
||||||
.values()) {
|
.values()) {
|
||||||
|
@ -208,6 +210,7 @@ public class RenderedContraption {
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
BlockModelRenderer.disableCache();
|
BlockModelRenderer.disableCache();
|
||||||
|
ForgeHooksClient.setRenderLayer(null);
|
||||||
|
|
||||||
builder.finishDrawing();
|
builder.finishDrawing();
|
||||||
return builder;
|
return builder;
|
||||||
|
|
|
@ -73,7 +73,9 @@ public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelW
|
||||||
lighter.updateSectionStatus(sectionPos, false);
|
lighter.updateSectionStatus(sectionPos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
lighter.checkBlock(pos);
|
if ((flags & 128) == 0) {
|
||||||
|
lighter.checkBlock(pos);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue