From a761ef4b6b796f8ab906145fdaa523affd233c8a Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 6 Aug 2023 19:19:45 -0500 Subject: [PATCH] Add setUseDhLighting to ChunkWrapper --- .../common/wrappers/chunk/ChunkWrapper.java | 15 ++++++++++----- coreSubProjects | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 6992e10f9..7e9437bc8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java @@ -73,7 +73,7 @@ public class ChunkWrapper implements IChunkWrapper private LinkedList blockLightPosList = null; - private final boolean useDhLightingEngine; + private boolean useDhLighting; /** * Due to vanilla `isClientLightReady()` not designed to be used by non-render thread, that value may return 'true' @@ -104,7 +104,7 @@ public class ChunkWrapper implements IChunkWrapper // TODO is this the best way to differentiate between when we are generating chunks and when MC gave us a chunk? boolean isDhGeneratedChunk = (this.lightSource.getClass() == DhLitWorldGenRegion.class); - this.useDhLightingEngine = isDhGeneratedChunk && (Config.Client.Advanced.WorldGenerator.worldGenLightingEngine.get() == ELightGenerationMode.DISTANT_HORIZONS); + this.useDhLighting = isDhGeneratedChunk && (Config.Client.Advanced.WorldGenerator.worldGenLightingEngine.get() == ELightGenerationMode.DISTANT_HORIZONS); weakMapLock.writeLock().lock(); chunksToUpdateClientLightReady.put(chunk, false); @@ -188,10 +188,15 @@ public class ChunkWrapper implements IChunkWrapper @Override public void setIsDhLightCorrect(boolean isDhLightCorrect) { this.isDhLightCorrect = isDhLightCorrect; } + @Override + public void setUseDhLighting(boolean useDhLighting) { this.useDhLighting = useDhLighting; } + + + @Override public boolean isLightCorrect() { - if (this.useDhLightingEngine) + if (this.useDhLighting) { return this.isDhLightCorrect; } @@ -256,7 +261,7 @@ public class ChunkWrapper implements IChunkWrapper throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(relX, relY, relZ); // use the full lighting engine when the chunks are within render distance or the config requests it - if (this.useDhLightingEngine) + if (this.useDhLighting) { // DH lighting method return this.blockLightAtRelBlockPos.getOrDefault(new DhBlockPos(relX, relY, relZ), 0); @@ -276,7 +281,7 @@ public class ChunkWrapper implements IChunkWrapper throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(relX, relY, relZ); // use the full lighting engine when the chunks are within render distance or the config requests it - if (this.useDhLightingEngine) + if (this.useDhLighting) { // DH lighting method return this.skyLightAtRelBlockPos.getOrDefault(new DhBlockPos(relX, relY, relZ), 0); diff --git a/coreSubProjects b/coreSubProjects index f8f6c9f87..38a7a837e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit f8f6c9f87721586d9ce1b8dab9bdfa7465d19018 +Subproject commit 38a7a837e774cb37df8865afb3bc9cc04e588e32