mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-28 22:05:01 +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()))
|
if (material.skipRendering(otherMaterial, dir.getOpposite()))
|
||||||
return isOccluded(state, neighborState, dir.getOpposite());
|
return isOccluded(state, neighborState, dir.getOpposite());
|
||||||
|
|
||||||
OcclusionTestLevel occlusionTestLevel = new OcclusionTestLevel();
|
OcclusionTestLevel occlusionTestLevel = new OcclusionTestLevel(level);
|
||||||
occlusionTestLevel.setBlock(pos, material);
|
occlusionTestLevel.setBlock(pos, material);
|
||||||
occlusionTestLevel.setBlock(otherPos, otherMaterial);
|
occlusionTestLevel.setBlock(otherPos, otherMaterial);
|
||||||
if (material.isSolidRender(occlusionTestLevel, pos) && otherMaterial.isSolidRender(occlusionTestLevel, otherPos))
|
if (material.isSolidRender(occlusionTestLevel, pos) && otherMaterial.isSolidRender(occlusionTestLevel, otherPos))
|
||||||
|
|
|
@ -22,6 +22,11 @@ import java.util.Map;
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
public class OcclusionTestLevel implements BlockGetter {
|
public class OcclusionTestLevel implements BlockGetter {
|
||||||
private final Map<BlockPos, BlockState> blocks = new HashMap<>();
|
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) {
|
public void setBlock(BlockPos pos, BlockState state) {
|
||||||
blocks.put(pos.immutable(), state);
|
blocks.put(pos.immutable(), state);
|
||||||
|
@ -49,11 +54,11 @@ public class OcclusionTestLevel implements BlockGetter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return 256;
|
return blockGetter.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinBuildHeight() {
|
public int getMinBuildHeight() {
|
||||||
return 0;
|
return blockGetter.getMinBuildHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue