diff --git a/src/main/java/com/sk89q/worldedit/EditSession.java b/src/main/java/com/sk89q/worldedit/EditSession.java index c7c2aca03..cc6ce130c 100644 --- a/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1313,11 +1313,7 @@ public class EditSession implements Extent { MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, getWorld().getMaxY()), new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), - new BlockMask(this, - new BaseBlock(BlockID.STATIONARY_LAVA, -1), - new BaseBlock(BlockID.LAVA, -1), - new BaseBlock(BlockID.STATIONARY_WATER, -1), - new BaseBlock(BlockID.WATER, -1))); + getWorld().createLiquidMask()); BlockReplace replace = new BlockReplace(this, new BlockPattern(new BaseBlock(BlockID.AIR))); RecursiveVisitor visitor = new RecursiveVisitor(mask, replace); diff --git a/src/main/java/com/sk89q/worldedit/LocalWorld.java b/src/main/java/com/sk89q/worldedit/LocalWorld.java index e4659459c..b2cf7638d 100644 --- a/src/main/java/com/sk89q/worldedit/LocalWorld.java +++ b/src/main/java/com/sk89q/worldedit/LocalWorld.java @@ -23,6 +23,8 @@ import com.sk89q.worldedit.blocks.*; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.foundation.Block; import com.sk89q.worldedit.foundation.World; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; @@ -35,6 +37,7 @@ import java.util.Random; * @author sk89q */ public abstract class LocalWorld implements World, Extent { + /** * Named flags to use as parameters to {@link LocalWorld#killMobs(Vector, double, int)} */ @@ -599,4 +602,20 @@ public abstract class LocalWorld implements World, Extent { return new BaseBlock(type, data); } } + + /** + * Create a mask that matches all liquids. + *

+ * Implementations should override this so that custom liquids are supported. + * + * @return a mask + */ + public Mask createLiquidMask() { + return new BlockMask(this, + new BaseBlock(BlockID.STATIONARY_LAVA, -1), + new BaseBlock(BlockID.LAVA, -1), + new BaseBlock(BlockID.STATIONARY_WATER, -1), + new BaseBlock(BlockID.WATER, -1)); + } + }