mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 13:28:00 +01:00
better occlusion testing
This commit is contained in:
parent
37b49a2c45
commit
d67274a589
2 changed files with 8 additions and 3 deletions
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue