diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 6cce701e2..6392be706 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -59,6 +59,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.core.Holder; +import org.jetbrains.annotations.Nullable; #endif public class BlockStateWrapper implements IBlockStateWrapper @@ -90,6 +91,7 @@ public class BlockStateWrapper implements IBlockStateWrapper // properties // + @Nullable public final BlockState blockState; /** technically final, but since it requires a method call to generate it can't be marked as such */ private String serialString; @@ -350,25 +352,42 @@ public class BlockStateWrapper implements IBlockStateWrapper } + // get block properties (default to the values used by air) + boolean canOcclude = false; + boolean propagatesSkyLightDown = true; + if (this.blockState != null) + { + canOcclude = this.blockState.canOcclude(); + + #if MC_VER < MC_1_21_3 + propagatesSkyLightDown = this.blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); + #else + propagatesSkyLightDown = this.blockState.propagatesSkylightDown(); + #endif + } + + + // this method isn't perfect, but works well enough for our use case int opacity; if (this.isAir()) { opacity = LodUtil.BLOCK_FULLY_TRANSPARENT; } - else if (this.isLiquid() && !this.blockState.canOcclude()) + else if (this.isLiquid() && !canOcclude) { // probably not a waterlogged block (which should block light entirely) // +1 to indicate that the block is translucent (in between transparent and opaque) opacity = LodUtil.BLOCK_FULLY_TRANSPARENT + 1; } - #if MC_VER < MC_1_21_3 - else if (this.blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)) - #else - else if (this.blockState.propagatesSkylightDown()) - #endif + else if (propagatesSkyLightDown && !canOcclude) { + // probably glass or some other fully transparent block + + // !canOcclude is required to ignore stairs and slabs since + // propagateSkyLightDown is true for them, but they're solid and don't actually let light through + opacity = LodUtil.BLOCK_FULLY_TRANSPARENT; } else diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 382944fe1..1a210d227 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java @@ -278,14 +278,14 @@ public class ChunkWrapper implements IChunkWrapper { // is this block solid? if (solidHeight == minInclusiveBuildHeight - && block.isSolid()) + && block.isSolid()) { solidHeight = y; } // is this block light blocking? if (lightBlockingHeight == minInclusiveBuildHeight - && block.getOpacity() != LodUtil.BLOCK_FULLY_TRANSPARENT) + && block.getOpacity() != LodUtil.BLOCK_FULLY_TRANSPARENT) { lightBlockingHeight = y; } diff --git a/coreSubProjects b/coreSubProjects index 736df9f84..766c831af 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 736df9f84885f4f2c11f3de66be9c0c281ab7428 +Subproject commit 766c831af0ef3dbc51a386569f6b1d78e68de654