Add setUseDhLighting to ChunkWrapper

This commit is contained in:
James Seibel
2023-08-06 19:19:45 -05:00
parent 3f4df4289c
commit a761ef4b6b
2 changed files with 11 additions and 6 deletions
@@ -73,7 +73,7 @@ public class ChunkWrapper implements IChunkWrapper
private LinkedList<DhBlockPos> 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);