Skip to main content

merged_face_occludes

Function merged_face_occludes 

Source
pub fn merged_face_occludes(
    shape1: VoxelShape,
    shape2: VoxelShape,
    direction: Direction,
) -> bool
Expand description

Checks if two voxel shapes fully occlude the face between them. Returns true if fluid/objects cannot pass through the face.

Direct equivalent of vanilla’s Shapes.mergedFaceOccludes(shape1, shape2, direction).

The algorithm:

  1. Fast path: if either shape is a full cube → true (face fully sealed).
  2. For each shape, keep only the face slice that actually touches the shared face boundary (shapes that don’t reach the boundary contribute nothing).
  3. Project both slices onto a 16×16 rasterisation grid and check if their union covers all 256 pixels.

Note: vanilla uses exact discrete-voxel arithmetic; the 16×16 rasterisation used here is equivalent for all vanilla block shapes (aligned to 1/16) but may have floating-point rounding for non-standard shapes from future mods.