From af11d1e78b0b5753bcdd2e87a9875a48d8f52138 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 8 Apr 2022 17:23:02 -0700 Subject: [PATCH] Fix spooky shaded contraptions - Logic error in GPULightVolume#move - Race condition from LightUpdater showing up in LightVolume#initialize --- .../com/jozufozu/flywheel/light/GPULightVolume.java | 11 ++--------- .../com/jozufozu/flywheel/light/LightUpdater.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/jozufozu/flywheel/light/GPULightVolume.java b/src/main/java/com/jozufozu/flywheel/light/GPULightVolume.java index 43d42d90a..fee086071 100644 --- a/src/main/java/com/jozufozu/flywheel/light/GPULightVolume.java +++ b/src/main/java/com/jozufozu/flywheel/light/GPULightVolume.java @@ -114,15 +114,8 @@ public class GPULightVolume extends LightVolume { if (lightData == null) return; if (box.contains(newSampleVolume)) { - if (newSampleVolume.intersects(sampleVolume)) { - GridAlignedBB newArea = newSampleVolume.intersect(sampleVolume); - sampleVolume.assign(newSampleVolume); - - copyLight(world, newArea); - } else { - sampleVolume.assign(newSampleVolume); - initialize(world); - } + sampleVolume.assign(newSampleVolume); + initialize(world); } else { super.move(world, newSampleVolume); } diff --git a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java index 6161fd803..c1b3b4f54 100644 --- a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java +++ b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java @@ -46,6 +46,19 @@ public class LightUpdater { } public void tick() { + tickSerial(); + //tickParallel(); + } + + private void tickSerial() { + for (MovingListener movingListener : movingListeners) { + if (movingListener.update(provider)) { + addListener(movingListener); + } + } + } + + private void tickParallel() { Queue listeners = new ConcurrentLinkedQueue<>(); taskEngine.group("LightUpdater")