mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-01-01 05:57:57 +01:00
Add mask flag to stack - alternate to //gsmask
This commit is contained in:
parent
ecbcc7e64b
commit
7a939e08bb
@ -690,6 +690,22 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
}
|
||||
}
|
||||
|
||||
public void addSourceMask(Mask mask) {
|
||||
checkNotNull(mask);
|
||||
Mask existing = getSourceMask();
|
||||
if (existing != null) {
|
||||
if (existing instanceof MaskIntersection) {
|
||||
((MaskIntersection) existing).add(mask);
|
||||
return;
|
||||
} else {
|
||||
MaskIntersection intersection = new MaskIntersection(existing);
|
||||
intersection.add(mask);
|
||||
mask = intersection;
|
||||
}
|
||||
}
|
||||
setSourceMask(mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a mask.
|
||||
*
|
||||
|
@ -532,7 +532,7 @@ public class RegionCommands {
|
||||
@Command(
|
||||
aliases = { "/stack" },
|
||||
usage = "[count] [direction]",
|
||||
flags = "sa",
|
||||
flags = "sam",
|
||||
desc = "Repeat the contents of the selection",
|
||||
help =
|
||||
"Repeats the contents of the selection.\n" +
|
||||
@ -549,7 +549,10 @@ public class RegionCommands {
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
@Optional(Direction.AIM) @Direction Vector direction,
|
||||
@Switch('s') boolean moveSelection,
|
||||
@Switch('a') boolean ignoreAirBlocks) throws WorldEditException {
|
||||
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask) throws WorldEditException {
|
||||
if (sourceMask != null) {
|
||||
editSession.addSourceMask(sourceMask);
|
||||
}
|
||||
int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks);
|
||||
|
||||
if (moveSelection) {
|
||||
|
@ -303,17 +303,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
}
|
||||
if (current.sourceMask != null) {
|
||||
Mask existingMask = editSession.getSourceMask();
|
||||
|
||||
if (existingMask == null) {
|
||||
editSession.setSourceMask(current.sourceMask);
|
||||
} else if (existingMask instanceof MaskIntersection) {
|
||||
((MaskIntersection) existingMask).add(current.sourceMask);
|
||||
} else {
|
||||
MaskIntersection newMask = new MaskIntersection(existingMask);
|
||||
newMask.add(current.sourceMask);
|
||||
editSession.setSourceMask(newMask);
|
||||
}
|
||||
editSession.addSourceMask(current.sourceMask);
|
||||
}
|
||||
if (current.transform != null) {
|
||||
editSession.addTransform(current.transform);
|
||||
|
Loading…
Reference in New Issue
Block a user