Potentially fix custom world generator snow lighting

This commit is contained in:
James Seibel
2023-08-18 20:51:29 -05:00
parent 974953ae9d
commit 158a614482
@@ -103,7 +103,19 @@ public class DhLightingEngine
for (int relZ = 0; relZ < LodUtil.CHUNK_WIDTH; relZ++)
{
// get the light
int maxY = chunk.getLightBlockingHeightMapValue(relX, relZ);
int maxY = Math.max(chunk.getLightBlockingHeightMapValue(relX, relZ), chunk.getSolidHeightMapValue(relX, relZ));
IBlockStateWrapper blockState = chunk.getBlockState(relX, maxY, relZ);
// go up until we reach open air or the world limit
while (!blockState.isAir() && maxY < chunk.getMaxBuildHeight())
{
// this shouldn't normally be necessary, but in the off change the height map is wrong,
// (like with a modded world generator)
// this should prevent generating skylights inside the ground
maxY++;
blockState = chunk.getBlockState(relX, maxY, relZ);
}
DhBlockPos skyLightPos = new DhBlockPos(chunk.getMinBlockX() + relX, maxY, chunk.getMinBlockZ() + relZ);
if (skyLightPos.y < chunk.getMinBuildHeight() || skyLightPos.y > chunk.getMaxBuildHeight())