From 0e91b6ae9bcbbcefe0b8548b3e1322fe085749c6 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 8 Dec 2021 22:01:02 -0800 Subject: Return 0 for light values if a dimenion does not have them Fixes https://github.com/PaperMC/Starlight/issues/99 --- patches/server/0815-Rewrite-the-light-engine.patch | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/patches/server/0815-Rewrite-the-light-engine.patch b/patches/server/0815-Rewrite-the-light-engine.patch index 33b3f235c3..4e4ff82174 100644 --- a/patches/server/0815-Rewrite-the-light-engine.patch +++ b/patches/server/0815-Rewrite-the-light-engine.patch @@ -3067,10 +3067,10 @@ index 0000000000000000000000000000000000000000..1b0d92c68407cdb09ed8aac271b625d9 +} diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/StarLightInterface.java b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightInterface.java new file mode 100644 -index 0000000000000000000000000000000000000000..7fe174f379ec8bb6a3e51251a5ed0e9ff64cf27b +index 0000000000000000000000000000000000000000..ef8dcbb6bbc0769e9ccfdadb05e6a46c070eda98 --- /dev/null +++ b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightInterface.java -@@ -0,0 +1,654 @@ +@@ -0,0 +1,665 @@ +package ca.spottedleaf.starlight.common.light; + +import ca.spottedleaf.starlight.common.util.CoordinateUtils; @@ -3127,6 +3127,9 @@ index 0000000000000000000000000000000000000000..7fe174f379ec8bb6a3e51251a5ed0e9f + + public final LevelLightEngine lightEngine; + ++ private final boolean hasBlockLight; ++ private final boolean hasSkyLight; ++ + public StarLightInterface(final LightChunkGetter lightAccess, final boolean hasSkyLight, final boolean hasBlockLight, final LevelLightEngine lightEngine) { + this.lightAccess = lightAccess; + this.world = lightAccess == null ? null : (Level)lightAccess.getLevel(); @@ -3145,6 +3148,8 @@ index 0000000000000000000000000000000000000000..7fe174f379ec8bb6a3e51251a5ed0e9f + this.maxLightSection = WorldUtil.getMaxLightSection(this.world); + } + this.lightEngine = lightEngine; ++ this.hasBlockLight = hasBlockLight; ++ this.hasSkyLight = hasSkyLight; + this.skyReader = !hasSkyLight ? LayerLightEventListener.DummyLightLayerEventListener.INSTANCE : new LayerLightEventListener() { + @Override + public void checkBlock(final BlockPos blockPos) { @@ -3253,6 +3258,9 @@ index 0000000000000000000000000000000000000000..7fe174f379ec8bb6a3e51251a5ed0e9f + } + + protected int getSkyLightValue(final BlockPos blockPos, final ChunkAccess chunk) { ++ if (!this.hasSkyLight) { ++ return 0; ++ } + final int x = blockPos.getX(); + int y = blockPos.getY(); + final int z = blockPos.getZ(); @@ -3320,6 +3328,9 @@ index 0000000000000000000000000000000000000000..7fe174f379ec8bb6a3e51251a5ed0e9f + } + + protected int getBlockLightValue(final BlockPos blockPos, final ChunkAccess chunk) { ++ if (!this.hasBlockLight) { ++ return 0; ++ } + final int y = blockPos.getY(); + final int cy = y >> 4; + -- cgit v1.2.3