@@ -2703,12 +2703,12 @@ private Direction[] getBlockedDirections(BlockVector3 position) {
27032703 *
27042704 * @return number of blocks affected
27052705 * @throws MaxChangedBlocksException thrown if too many blocks are changed
2706- * @deprecated Use {@link EditSession#hollowOutRegion(Region, int, Pattern, boolean, Collection, boolean)} instead.
2706+ * @deprecated Use {@link EditSession#hollowOutRegion(Region, int, Pattern, boolean, Collection, boolean, Mask )} instead.
27072707 */
2708- @ InlineMe (replacement = "this.hollowOutRegion(region, thickness, pattern, true, null, false) " )
2708+ @ InlineMe (replacement = "this.hollowOutRegion(region, thickness, pattern, true, null, false, Masks.alwaysTrue())" , imports = "com.sk89q.worldedit.function.mask.Masks " )
27092709 @ Deprecated
27102710 public final int hollowOutRegion (Region region , int thickness , Pattern pattern ) throws MaxChangedBlocksException {
2711- return hollowOutRegion (region , thickness , pattern , true , null , false );
2711+ return hollowOutRegion (region , thickness , pattern , true , null , false , Masks . alwaysTrue () );
27122712 }
27132713
27142714 /**
@@ -2721,10 +2721,11 @@ public final int hollowOutRegion(Region region, int thickness, Pattern pattern)
27212721 * @param openSides Open up faces touching the bounding box. This matches the legacy behaviour.
27222722 * @param startingPositions Positions to consider as 'outside'. If null, use the selection bounding box
27232723 * @param useBlockGeometry Consider block geometry for visibility calculation
2724+ * @param includeMask Mask of blocks eligible for shell detection
27242725 * @return number of blocks affected
27252726 * @throws MaxChangedBlocksException thrown if too many blocks are changed
27262727 */
2727- public int hollowOutRegion (Region region , int thickness , Pattern pattern , boolean openSides , Collection <BlockVector3 > startingPositions , boolean useBlockGeometry ) throws MaxChangedBlocksException {
2728+ public int hollowOutRegion (Region region , int thickness , Pattern pattern , boolean openSides , Collection <BlockVector3 > startingPositions , boolean useBlockGeometry , Mask includeMask ) throws MaxChangedBlocksException {
27282729 if (startingPositions == null ) {
27292730 // If no startingPositions are specified, use the selection bounding box
27302731 startingPositions = new ArrayList <>();
@@ -2779,7 +2780,9 @@ public int hollowOutRegion(Region region, int thickness, Pattern pattern, boolea
27792780 final BlockVector3 current = queue .poll ();
27802781
27812782 Direction [] blockedDirections ;
2782- if (useBlockGeometry ) {
2783+ if (!includeMask .test (current )) {
2784+ blockedDirections = NO_DIRECTIONS ;
2785+ } else if (useBlockGeometry ) {
27832786 // Get blocked directions for this block
27842787 blockedDirections = getBlockedDirections (current );
27852788
@@ -2823,11 +2826,13 @@ public int hollowOutRegion(Region region, int thickness, Pattern pattern, boolea
28232826 continue ;
28242827 }
28252828
2826- // Check if we can actually enter the block from here
2827- Direction oppositeDirection = Direction .findClosest (direction .toVector ().multiply (-1 ), Direction .Flag .ALL );
2828- for (Direction blockedDirection : getBlockedDirections (neighbor )) {
2829- if (blockedDirection == oppositeDirection ) {
2830- continue outer ; // skip this direction
2829+ if (includeMask .test (neighbor )) {
2830+ // Check if we can actually enter the block from here
2831+ Direction oppositeDirection = Direction .findClosest (direction .toVector ().multiply (-1 ), Direction .Flag .ALL );
2832+ for (Direction blockedDirection : getBlockedDirections (neighbor )) {
2833+ if (blockedDirection == oppositeDirection ) {
2834+ continue outer ; // skip this direction
2835+ }
28312836 }
28322837 }
28332838
0 commit comments