Contraptions were too lit

- Fix bug causing potentially moving contraptions to re-upload their light every tick
 - Reduces tick stutter with large amounts of contraptions
This commit is contained in:
Jozufozu 2022-03-16 22:57:31 -07:00
parent eb74505ce8
commit 9ca26d674c
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
lightUpdater = LightUpdater.get(contraption.entity.level);
bounds = getContraptionBounds();
growBoundsForEdgeData();
growBoundsForEdgeData(bounds);
lightVolume = new GPULightVolume(bounds);
@ -51,7 +51,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
lightVolume.onLightPacket(world, chunkX, chunkZ);
}
protected void growBoundsForEdgeData() {
protected static void growBoundsForEdgeData(GridAlignedBB bounds) {
// so we have at least enough data on the edges to avoid artifacts and have smooth lighting
bounds.grow(2);
}

View File

@ -18,11 +18,11 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
ImmutableBox contraptionBounds = getContraptionBounds();
if (bounds.sameAs(contraptionBounds)) {
if (bounds.sameAs(contraptionBounds, 2)) {
return false;
}
bounds.assign(contraptionBounds);
growBoundsForEdgeData();
growBoundsForEdgeData(bounds);
lightVolume.move(provider, bounds);