Implement ability to use -w flag on //drain

fixes #464
This commit is contained in:
dordsor21 2020-07-03 13:49:17 +01:00
parent 63bc151f6c
commit ea7897934f
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 9 additions and 8 deletions

View File

@ -63,6 +63,7 @@ import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.block.Naturalizer;
import com.sk89q.worldedit.function.generator.ForestGenerator; import com.sk89q.worldedit.function.generator.ForestGenerator;
import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.generator.GardenPatchGenerator;
import com.sk89q.worldedit.function.mask.BlockStateMask;
import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.BoundedHeightMask;
import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask;
@ -135,6 +136,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -1624,13 +1626,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
checkNotNull(origin); checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required"); checkArgument(radius >= 0, "radius >= 0 required");
Mask liquidMask; Mask liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER);
// Not thread safe, use hardcoded liquidmask if (waterlogged) {
// if (getWorld() != null) { Map<String, String> stateMap = new HashMap<>();
// liquidMask = getWorld().createLiquidMask(); stateMap.put("waterlogged", "true");
// } else { liquidMask = new MaskUnion(liquidMask, new BlockStateMask(this, stateMap, true));
// } }
liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER);
Mask mask = new MaskIntersection( Mask mask = new MaskIntersection(
new BoundedHeightMask(0, getWorld().getMaxY()), new BoundedHeightMask(0, getWorld().getMaxY()),
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),

View File

@ -45,7 +45,7 @@ public class WaterloggedRemover extends AbstractExtentPattern {
// init // init
for (int i = 0; i < remap.length; i++) { for (int i = 0; i < remap.length; i++) {
BlockState state = remap[i]; BlockState state = BlockTypesCache.states[i];
BlockType type = state.getBlockType(); BlockType type = state.getBlockType();
if (!type.hasProperty(PropertyKey.WATERLOGGED)) { if (!type.hasProperty(PropertyKey.WATERLOGGED)) {
continue; continue;