Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: copycat panel block face culling #6830

Open
wants to merge 3 commits into
base: mc1.20.1/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
better occlusion testing
  • Loading branch information
IThundxr committed Aug 27, 2024
commit d67274a589e0257c6b8e0581ae933ce158a1e8d3
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState sta
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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
@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);
Expand Down Expand Up @@ -49,11 +54,11 @@ public FluidState getFluidState(BlockPos pos) {

@Override
public int getHeight() {
return 256;
return blockGetter.getHeight();
}

@Override
public int getMinBuildHeight() {
return 0;
return blockGetter.getMinBuildHeight();
}
}