From 0e1c4c49c29c88857815fd4a8567904ddbd505b1 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 19 Aug 2023 08:50:20 -0500 Subject: [PATCH 1/2] Change RenderSourceFileHandler cache log from info -> debug --- .../core/file/renderfile/RenderSourceFileHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/renderfile/RenderSourceFileHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/file/renderfile/RenderSourceFileHandler.java index edbb8f651..30c5e64b9 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/renderfile/RenderSourceFileHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/renderfile/RenderSourceFileHandler.java @@ -448,7 +448,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider // Skip updating the cache if the data file is already up-to-date FullDataMetaFile dataFile = this.fullDataSourceProvider.getFileIfExist(file.pos); if (!ALWAYS_INVALIDATE_CACHE && dataFile != null && dataFile.baseMetaData.checksum == file.baseMetaData.dataVersion.get()) { - LOGGER.info("Skipping render cache update for {}", file.pos); + LOGGER.debug("Skipping render cache update for {}", file.pos); renderSource.localVersion.incrementAndGet(); return CompletableFuture.completedFuture(null); } From 4bf12c7fc4aaca78c8d40fac12871db3818a7caf Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 19 Aug 2023 11:01:52 -0500 Subject: [PATCH 2/2] Fix lighting and LOD generation for snow layers --- .../dataObjects/transformers/LodDataBuilder.java | 16 +++++++++++++--- .../core/generation/DhLightingEngine.java | 15 +-------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java index 8f7c3b1c9..cafafa6b5 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java @@ -38,9 +38,19 @@ public class LodDataBuilder // FIXME: The +1 offset to reproduce the old behavior. Remove this when we get per-face lighting byte light = (byte) ((chunkWrapper.getBlockLight(x, lastY + 1, z) << 4) + chunkWrapper.getSkyLight(x, lastY + 1, z)); - // using a height map to reduce how many empty blocks positions we have to check would be preferable, but there are some world generators - // that don't work well with that, so we have to check the whole column - int y = chunkWrapper.getMaxBuildHeight(); + + // determine the starting Y Pos + int y = chunkWrapper.getLightBlockingHeightMapValue(x,z); + // go up until we reach open air or the world limit + IBlockStateWrapper topBlockState = chunkWrapper.getBlockState(x, y, z); + while (!topBlockState.isAir() && y < chunkWrapper.getMaxBuildHeight()) + { + // This is necessary in some edge cases with snow layers and some other blocks that may not appear in the height map but do block light. + // Interestingly this doesn't appear to be the case in the DhLightingEngine, if this same logic is added there the lighting breaks for the affected blocks. + y++; + topBlockState = chunkWrapper.getBlockState(x, y, z); + } + for (; y >= chunkWrapper.getMinBuildHeight(); y--) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java index 93eae35ee..bbc035d04 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java @@ -103,21 +103,8 @@ public class DhLightingEngine for (int relZ = 0; relZ < LodUtil.CHUNK_WIDTH; relZ++) { // get the light - 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); - } - + int maxY = chunk.getLightBlockingHeightMapValue(relX, relZ); DhBlockPos skyLightPos = new DhBlockPos(chunk.getMinBlockX() + relX, maxY, chunk.getMinBlockZ() + relZ); - if (skyLightPos.y < chunk.getMinBuildHeight() || skyLightPos.y > chunk.getMaxBuildHeight()) { // this shouldn't normally happen