better occlusion testing

This commit is contained in:
IThundxr 2024-08-27 11:08:31 -04:00
parent 37b49a2c45
commit d67274a589
Failed to generate hash of commit
2 changed files with 8 additions and 3 deletions

View file

@ -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))

View file

@ -22,6 +22,11 @@ import java.util.Map;
@MethodsReturnNonnullByDefault
public class OcclusionTestLevel implements BlockGetter {
private final Map<BlockPos, BlockState> 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();
}
}