@@ -2709,12 +2709,12 @@ private Direction[] getBlockedDirections(BlockVector3 position) {
27092709 *
27102710 * @return number of blocks affected
27112711 * @throws MaxChangedBlocksException thrown if too many blocks are changed
2712- * @deprecated Use {@link EditSession#hollowOutRegion(Region, int, Pattern, boolean, Collection, boolean)} instead.
2712+ * @deprecated Use {@link EditSession#hollowOutRegion(Region, int, Pattern, boolean, Collection, boolean, Mask )} instead.
27132713 */
2714- @ InlineMe (replacement = "this.hollowOutRegion(region, thickness, pattern, true, null, false) " )
2714+ @ InlineMe (replacement = "this.hollowOutRegion(region, thickness, pattern, true, null, false, Masks.alwaysTrue())" , imports = "com.sk89q.worldedit.function.mask.Masks " )
27152715 @ Deprecated
27162716 public final int hollowOutRegion (Region region , int thickness , Pattern pattern ) throws MaxChangedBlocksException {
2717- return hollowOutRegion (region , thickness , pattern , true , null , false );
2717+ return hollowOutRegion (region , thickness , pattern , true , null , false , Masks . alwaysTrue () );
27182718 }
27192719
27202720 /**
@@ -2727,10 +2727,11 @@ public final int hollowOutRegion(Region region, int thickness, Pattern pattern)
27272727 * @param openSides Open up faces touching the bounding box. This matches the legacy behaviour.
27282728 * @param startingPositions Positions to consider as 'outside'. If null, use the selection bounding box
27292729 * @param useBlockGeometry Consider block geometry for visibility calculation
2730+ * @param includeMask Mask of blocks eligible for shell detection
27302731 * @return number of blocks affected
27312732 * @throws MaxChangedBlocksException thrown if too many blocks are changed
27322733 */
2733- public int hollowOutRegion (Region region , int thickness , Pattern pattern , boolean openSides , Collection <BlockVector3 > startingPositions , boolean useBlockGeometry ) throws MaxChangedBlocksException {
2734+ public int hollowOutRegion (Region region , int thickness , Pattern pattern , boolean openSides , Collection <BlockVector3 > startingPositions , boolean useBlockGeometry , Mask includeMask ) throws MaxChangedBlocksException {
27342735 if (startingPositions == null ) {
27352736 // If no startingPositions are specified, use the selection bounding box
27362737 startingPositions = new ArrayList <>();
@@ -2785,7 +2786,9 @@ public int hollowOutRegion(Region region, int thickness, Pattern pattern, boolea
27852786 final BlockVector3 current = queue .poll ();
27862787
27872788 Direction [] blockedDirections ;
2788- if (useBlockGeometry ) {
2789+ if (!includeMask .test (current )) {
2790+ blockedDirections = NO_DIRECTIONS ;
2791+ } else if (useBlockGeometry ) {
27892792 // Get blocked directions for this block
27902793 blockedDirections = getBlockedDirections (current );
27912794
@@ -2829,11 +2832,13 @@ public int hollowOutRegion(Region region, int thickness, Pattern pattern, boolea
28292832 continue ;
28302833 }
28312834
2832- // Check if we can actually enter the block from here
2833- Direction oppositeDirection = Direction .findClosest (direction .toVector ().multiply (-1 ), Direction .Flag .ALL );
2834- for (Direction blockedDirection : getBlockedDirections (neighbor )) {
2835- if (blockedDirection == oppositeDirection ) {
2836- continue outer ; // skip this direction
2835+ if (includeMask .test (neighbor )) {
2836+ // Check if we can actually enter the block from here
2837+ Direction oppositeDirection = Direction .findClosest (direction .toVector ().multiply (-1 ), Direction .Flag .ALL );
2838+ for (Direction blockedDirection : getBlockedDirections (neighbor )) {
2839+ if (blockedDirection == oppositeDirection ) {
2840+ continue outer ; // skip this direction
2841+ }
28372842 }
28382843 }
28392844
0 commit comments