Skip to content

Commit

Permalink
use existing utility methods when checking for empty and full shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
douira committed Dec 4, 2024
1 parent 8ddfd0c commit 4c7b2c9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public boolean shouldDrawFullBlockFluidSide(BlockState selfBlockState, BlockGett
var selfShape = selfBlockState.getFaceOcclusionShape(facing);

// only a non-empty self-shape can occlude anything
if (!selfShape.isEmpty()) {
if (!isEmptyShape(selfShape)) {
// a full self-shape occludes everything
if (selfShape == Shapes.block() && fluidShapeIsBlock) {
if (isFullShape(selfShape) && fluidShapeIsBlock) {
return false;
}

Expand Down Expand Up @@ -149,13 +149,13 @@ public boolean shouldDrawFullBlockFluidSide(BlockState selfBlockState, BlockGett
var otherShape = otherState.getFaceOcclusionShape(facing.getOpposite());

// If the other block has an empty cull shape, then it cannot hide any geometry
if (otherShape.isEmpty()) {
if (isEmptyShape(otherShape)) {
return true;
}

// If both blocks use a full-cube cull shape, then they will always hide the faces between each other.
// No voxel shape comparison is done after this point because it's redundant with the later more accurate check.
return otherShape != Shapes.block() || !fluidShapeIsBlock;
return !isFullShape(otherShape) || !fluidShapeIsBlock;
}

private boolean lookup(VoxelShape self, VoxelShape other) {
Expand Down

0 comments on commit 4c7b2c9

Please sign in to comment.