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;
|
+ 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) {
|
+ public StarLightInterface(final LightChunkGetter lightAccess, final boolean hasSkyLight, final boolean hasBlockLight, final LevelLightEngine lightEngine) {
|
||||||
+ this.lightAccess = lightAccess;
|
+ this.lightAccess = lightAccess;
|
||||||
+ this.world = lightAccess == null ? null : (Level)lightAccess.getLevel();
|
+ this.world = lightAccess == null ? null : (Level)lightAccess.getLevel();
|
||||||
@ -3145,6 +3148,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.maxLightSection = WorldUtil.getMaxLightSection(this.world);
|
+ this.maxLightSection = WorldUtil.getMaxLightSection(this.world);
|
||||||
+ }
|
+ }
|
||||||
+ this.lightEngine = lightEngine;
|
+ this.lightEngine = lightEngine;
|
||||||
|
+ this.hasBlockLight = hasBlockLight;
|
||||||
|
+ this.hasSkyLight = hasSkyLight;
|
||||||
+ this.skyReader = !hasSkyLight ? LayerLightEventListener.DummyLightLayerEventListener.INSTANCE : new LayerLightEventListener() {
|
+ this.skyReader = !hasSkyLight ? LayerLightEventListener.DummyLightLayerEventListener.INSTANCE : new LayerLightEventListener() {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void checkBlock(final BlockPos blockPos) {
|
+ public void checkBlock(final BlockPos blockPos) {
|
||||||
@ -3253,6 +3258,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ protected int getSkyLightValue(final BlockPos blockPos, final ChunkAccess chunk) {
|
+ protected int getSkyLightValue(final BlockPos blockPos, final ChunkAccess chunk) {
|
||||||
|
+ if (!this.hasSkyLight) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
+ final int x = blockPos.getX();
|
+ final int x = blockPos.getX();
|
||||||
+ int y = blockPos.getY();
|
+ int y = blockPos.getY();
|
||||||
+ final int z = blockPos.getZ();
|
+ final int z = blockPos.getZ();
|
||||||
@ -3320,6 +3328,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ protected int getBlockLightValue(final BlockPos blockPos, final ChunkAccess chunk) {
|
+ protected int getBlockLightValue(final BlockPos blockPos, final ChunkAccess chunk) {
|
||||||
|
+ if (!this.hasBlockLight) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
+ final int y = blockPos.getY();
|
+ final int y = blockPos.getY();
|
||||||
+ final int cy = y >> 4;
|
+ final int cy = y >> 4;
|
||||||
+
|
+
|
||||||
|
|||||||
Reference in New Issue
Block a user