diff --git a/src/main/java/dev/redstudio/alfheim/lighting/LightingEngine.java b/src/main/java/dev/redstudio/alfheim/lighting/LightingEngine.java index 6d2249e..ab8745d 100644 --- a/src/main/java/dev/redstudio/alfheim/lighting/LightingEngine.java +++ b/src/main/java/dev/redstudio/alfheim/lighting/LightingEngine.java @@ -443,7 +443,12 @@ private void spreadLightFromCursor(final byte currentLight, final EnumSkyBlock l final BlockPos neighborBlockPos = neighborInfo.mutableBlockPos; - final byte newLight = (byte) (currentLight - getPosOpacity(neighborBlockPos, neighborChunk.getBlockState(neighborBlockPos), neighborChunk)); + final IBlockState neighborState = neighborChunk.getBlockState(neighborBlockPos); + final byte propagatedLight = (byte) (currentLight - getPosOpacity(neighborBlockPos, neighborState, neighborChunk)); + // A neighbour reached by propagation must not drop below its own emission: an emitting block (e.g. lava at 15) that is not scheduled itself would otherwise keep the lower value. + // Sky light is excluded because its source is the sky, not the block itself. + final byte ownLight = lightType == EnumSkyBlock.BLOCK ? (byte) ClampUtil.clampMinFirst(LightUtil.getLightValueForPos(neighborState, world, neighborBlockPos, neighborChunk), 0, MAX_LIGHT_LEVEL) : 0; + final byte newLight = (byte) Math.max(propagatedLight, ownLight); if (newLight > neighborInfo.light) enqueueBrightening(neighborBlockPos, neighborInfo.key, newLight, neighborChunk, lightType);