aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2021-12-08 22:01:02 -0800
committerSpottedleaf <[email protected]>2021-12-08 22:01:02 -0800
commit0e91b6ae9bcbbcefe0b8548b3e1322fe085749c6 (patch)
treefcb8fad2c3cc7c6bf2a36f441b660a9535e6dc05
parent758e2a7ee201ea2cdd446d2353437d2b4b03fb7d (diff)
downloadPaper-0e91b6ae9bcbbcefe0b8548b3e1322fe085749c6.tar.gz
Paper-0e91b6ae9bcbbcefe0b8548b3e1322fe085749c6.zip
Return 0 for light values if a dimenion does not have them
Fixes https://github.com/PaperMC/Starlight/issues/99
-rw-r--r--patches/server/0815-Rewrite-the-light-engine.patch15
1 files 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;
+