diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java index 92a7b2ff9..54691d76c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java @@ -21,6 +21,7 @@ public class NonStationaryLighter extends ContraptionLigh @Override public void tick(RenderedContraption owner) { + super.tick(owner); GridAlignedBB contraptionBounds = getContraptionBounds(); if (!contraptionBounds.sameAs(bounds)) { diff --git a/src/main/java/com/simibubi/create/foundation/render/contraption/RenderedContraption.java b/src/main/java/com/simibubi/create/foundation/render/contraption/RenderedContraption.java index 76e8d7f9a..b36430fc3 100644 --- a/src/main/java/com/simibubi/create/foundation/render/contraption/RenderedContraption.java +++ b/src/main/java/com/simibubi/create/foundation/render/contraption/RenderedContraption.java @@ -32,7 +32,7 @@ public class RenderedContraption { public final ContraptionKineticRenderer kinetics; - private Contraption contraption; + public Contraption contraption; private Matrix4f model; diff --git a/src/main/java/com/simibubi/create/foundation/render/light/ContraptionLighter.java b/src/main/java/com/simibubi/create/foundation/render/light/ContraptionLighter.java index 68b4342cc..403fecee2 100644 --- a/src/main/java/com/simibubi/create/foundation/render/light/ContraptionLighter.java +++ b/src/main/java/com/simibubi/create/foundation/render/light/ContraptionLighter.java @@ -2,11 +2,6 @@ package com.simibubi.create.foundation.render.light; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.foundation.render.contraption.RenderedContraption; -import net.minecraft.util.math.SectionPos; -import net.minecraft.world.ILightReader; -import net.minecraft.world.LightType; - -import static com.simibubi.create.foundation.render.RenderMath.nextPowerOf2; public abstract class ContraptionLighter { protected final C contraption; @@ -14,6 +9,8 @@ public abstract class ContraptionLighter { protected GridAlignedBB bounds; + protected boolean scheduleRebuild; + protected ContraptionLighter(C contraption) { this.contraption = contraption; @@ -22,6 +19,7 @@ public abstract class ContraptionLighter { lightVolume = new LightVolume(contraptionBoundsToVolume(bounds)); lightVolume.initialize(contraption.entity.world); + scheduleRebuild = true; } protected GridAlignedBB contraptionBoundsToVolume(GridAlignedBB bounds) { @@ -33,7 +31,12 @@ public abstract class ContraptionLighter { return bounds; } - public void tick(RenderedContraption owner) {} + public void tick(RenderedContraption owner) { + if (scheduleRebuild) { + lightVolume.initialize(owner.contraption.entity.world); + scheduleRebuild = false; + } + } public abstract GridAlignedBB getContraptionBounds(); }