13
0
geforkt von Mirrors/Paper

Return 0 for light values if a dimenion does not have them

Fixes https://github.com/PaperMC/Starlight/issues/99
Dieser Commit ist enthalten in:
Spottedleaf 2021-12-08 22:01:02 -08:00
Ursprung 3bf392595d
Commit 16d11b8180

Datei anzeigen

@ -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;
+