mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
Return 0 for light values if a dimenion does not have them
Fixes https://github.com/PaperMC/Starlight/issues/99
This commit is contained in:
@@ -3127,6 +3127,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ protected int getBlockLightValue(final BlockPos blockPos, final ChunkAccess chunk) {
|
||||
+ if (!this.hasBlockLight) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ final int y = blockPos.getY();
|
||||
+ final int cy = y >> 4;
|
||||
+
|
||||
|
Reference in New Issue
Block a user