Don't get block light level if the sky level is 15 (#6922)

This commit is contained in:
Noah van der Aa 2021-12-04 14:24:40 +01:00
parent bc04c3f9bc
commit 3f7c1464c8

View File

@ -3341,6 +3341,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ChunkAccess chunk = this.getAnyChunkNow(pos.getX() >> 4, pos.getZ() >> 4);
+
+ final int sky = this.getSkyLightValue(pos, chunk) - ambientDarkness;
+ // Don't fetch the block light level if the skylight level is 15, since the value will never be higher.
+ if (sky == 15) return 15;
+ final int block = this.getBlockLightValue(pos, chunk);
+ return Math.max(sky, block);
+ }
@ -4612,6 +4614,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public int getRawBrightness(final BlockPos pos, final int ambientDarkness) {
+ // need to use new light hooks for this
+ final int sky = this.theLightEngine.getSkyReader().getLightValue(pos) - ambientDarkness;
+ // Don't fetch the block light level if the skylight level is 15, since the value will never be higher.
+ if (sky == 15) return 15;
+ final int block = this.theLightEngine.getBlockReader().getLightValue(pos);
+ return Math.max(sky, block);
+ }