Fix crash rendering contraption with batching engine

This commit is contained in:
Jozufozu 2022-01-17 16:27:00 -08:00
parent 6a189458ac
commit 33d0f8c352
3 changed files with 6 additions and 1 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2021.12.19
# dependency versions
registrate_version = MC1.18-1.0.21
flywheel_version = 1.18-0.5.1.44
flywheel_version = 1.18-0.5.1.46
jei_minecraft_version = 1.18
jei_version = 9.0.0.40

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
import com.jozufozu.flywheel.backend.instancing.Engine;
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
import com.jozufozu.flywheel.backend.instancing.SerialTaskEngine;
@ -50,11 +51,13 @@ public class FlwContraption extends ContraptionRenderInfo {
instanceWorld = new ContraptionInstanceWorld(this);
var restoreState = GlStateTracker.getRestoreState();
buildLayers();
if (Backend.isOn()) {
buildInstancedTiles();
buildActors();
}
restoreState.restore();
}
public ContraptionLighter<?> getLighter() {

View file

@ -58,6 +58,7 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
}
restoreState.restore();
layer.setupRenderState();
if (Backend.isOn()) {
RenderLayer renderLayer = event.getLayer();
@ -75,6 +76,7 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
layer.clearRenderState();
active.makeActive();
restoreState.restore();
}
@Override