Skip to content

Commit

Permalink
Return 0 for light values if a dimenion does not have them
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf committed Dec 8, 2021
1 parent 31ab416 commit e9ff6b7
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public final class StarLightInterface {

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();
Expand All @@ -72,6 +75,8 @@ public StarLightInterface(final LightChunkGetter lightAccess, final boolean hasS
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) {
Expand Down Expand Up @@ -180,6 +185,9 @@ public void updateSectionStatus(final SectionPos pos, final boolean notReady) {
}

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();
Expand Down Expand Up @@ -247,6 +255,9 @@ protected int getSkyLightValue(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 cy = y >> 4;

Expand Down

0 comments on commit e9ff6b7

Please sign in to comment.