From d67274a589e0257c6b8e0581ae933ce158a1e8d3 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 27 Aug 2024 11:08:31 -0400 Subject: [PATCH] better occlusion testing --- .../content/decoration/copycat/CopycatPanelBlock.java | 2 +- .../utility/worldWrappers/OcclusionTestLevel.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java index 5b2a80f6d..0c8adbcf5 100644 --- a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java @@ -188,7 +188,7 @@ public class CopycatPanelBlock extends WaterloggedCopycatBlock { if (material.skipRendering(otherMaterial, dir.getOpposite())) return isOccluded(state, neighborState, dir.getOpposite()); - OcclusionTestLevel occlusionTestLevel = new OcclusionTestLevel(); + OcclusionTestLevel occlusionTestLevel = new OcclusionTestLevel(level); occlusionTestLevel.setBlock(pos, material); occlusionTestLevel.setBlock(otherPos, otherMaterial); if (material.isSolidRender(occlusionTestLevel, pos) && otherMaterial.isSolidRender(occlusionTestLevel, otherPos)) diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/OcclusionTestLevel.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/OcclusionTestLevel.java index ef72b63c8..458599c8e 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/OcclusionTestLevel.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/OcclusionTestLevel.java @@ -22,6 +22,11 @@ import java.util.Map; @MethodsReturnNonnullByDefault public class OcclusionTestLevel implements BlockGetter { private final Map blocks = new HashMap<>(); + private final BlockGetter blockGetter; + + public OcclusionTestLevel(BlockGetter blockGetter) { + this.blockGetter = blockGetter; + } public void setBlock(BlockPos pos, BlockState state) { blocks.put(pos.immutable(), state); @@ -49,11 +54,11 @@ public class OcclusionTestLevel implements BlockGetter { @Override public int getHeight() { - return 256; + return blockGetter.getHeight(); } @Override public int getMinBuildHeight() { - return 0; + return blockGetter.getMinBuildHeight(); } }