geforkt von Mirrors/FastAsyncWorldEdit
Ursprung
43a6541763
Commit
da034f9ac4
@ -100,6 +100,7 @@ import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.NoiseFilter2D;
|
||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -2856,6 +2857,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
public int hollowOutRegion(final Region region, final int thickness, final Pattern pattern) {
|
||||
return hollowOutRegion(region, thickness, pattern, new SolidBlockMask(this));
|
||||
}
|
||||
|
||||
public int hollowOutRegion(final Region region, final int thickness, final Pattern pattern, Mask mask) {
|
||||
try {
|
||||
final Set outside = new LocalBlockVectorSet();
|
||||
|
||||
@ -2871,22 +2876,22 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
|
||||
for (int x = minX; x <= maxX; ++x) {
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
recurseHollow(region, BlockVector3.at(x, y, minZ), outside);
|
||||
recurseHollow(region, BlockVector3.at(x, y, maxZ), outside);
|
||||
recurseHollow(region, BlockVector3.at(x, y, minZ), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, y, maxZ), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
recurseHollow(region, BlockVector3.at(minX, y, z), outside);
|
||||
recurseHollow(region, BlockVector3.at(maxX, y, z), outside);
|
||||
recurseHollow(region, BlockVector3.at(minX, y, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(maxX, y, z), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
for (int x = minX; x <= maxX; ++x) {
|
||||
recurseHollow(region, BlockVector3.at(x, minY, z), outside);
|
||||
recurseHollow(region, BlockVector3.at(x, maxY, z), outside);
|
||||
recurseHollow(region, BlockVector3.at(x, minY, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, maxY, z), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3120,15 +3125,14 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
return returnset;
|
||||
}
|
||||
|
||||
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside) {
|
||||
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside, Mask mask) {
|
||||
final LocalBlockVectorSet queue = new LocalBlockVectorSet();
|
||||
while (!queue.isEmpty()) {
|
||||
Iterator<BlockVector3> iter = queue.iterator();
|
||||
while (iter.hasNext()) {
|
||||
BlockVector3 current = iter.next();
|
||||
iter.remove();
|
||||
final BlockState block = getBlock(current);
|
||||
if (block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
if (mask.test(current)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ import com.sk89q.worldedit.function.generator.FloraGenerator;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.NoiseFilter2D;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
||||
@ -784,7 +785,10 @@ public class RegionCommands extends MethodCommands {
|
||||
help =
|
||||
"Hollows out the object contained in this selection.\n" +
|
||||
"Optionally fills the hollowed out part with the given block.\n" +
|
||||
"Thickness is measured in manhattan distance.",
|
||||
"Thickness is measured in manhattan distance.\n" +
|
||||
"Flags:\n" +
|
||||
" -m Mask, uses a mask to hollow",
|
||||
|
||||
min = 0,
|
||||
max = 2
|
||||
)
|
||||
@ -794,9 +798,11 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Optional("0") @Range(min = 0) int thickness,
|
||||
@Optional("air") Pattern pattern,
|
||||
@Switch('m') Mask mask,
|
||||
CommandContext context) throws WorldEditException {
|
||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.hollowOutRegion(region, thickness, pattern);
|
||||
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, getArguments(context), region, context);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren