mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-15 00:37:09 +01:00
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:
parent
eb74505ce8
commit
9ca26d674c
2 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
|
||||||
lightUpdater = LightUpdater.get(contraption.entity.level);
|
lightUpdater = LightUpdater.get(contraption.entity.level);
|
||||||
|
|
||||||
bounds = getContraptionBounds();
|
bounds = getContraptionBounds();
|
||||||
growBoundsForEdgeData();
|
growBoundsForEdgeData(bounds);
|
||||||
|
|
||||||
lightVolume = new GPULightVolume(bounds);
|
lightVolume = new GPULightVolume(bounds);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
|
||||||
lightVolume.onLightPacket(world, chunkX, chunkZ);
|
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
|
// so we have at least enough data on the edges to avoid artifacts and have smooth lighting
|
||||||
bounds.grow(2);
|
bounds.grow(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
|
||||||
|
|
||||||
ImmutableBox contraptionBounds = getContraptionBounds();
|
ImmutableBox contraptionBounds = getContraptionBounds();
|
||||||
|
|
||||||
if (bounds.sameAs(contraptionBounds)) {
|
if (bounds.sameAs(contraptionBounds, 2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bounds.assign(contraptionBounds);
|
bounds.assign(contraptionBounds);
|
||||||
growBoundsForEdgeData();
|
growBoundsForEdgeData(bounds);
|
||||||
|
|
||||||
lightVolume.move(provider, bounds);
|
lightVolume.move(provider, bounds);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue