Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 10:30:04 +01:00
Add entity, biome, and mask flags to clipboard brush.
Dieser Commit ist enthalten in:
Ursprung
31a8328fb5
Commit
648ecf2153
@ -131,7 +131,7 @@ public class BrushCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = { "clipboard", "copy" },
|
aliases = { "clipboard", "copy" },
|
||||||
usage = "",
|
usage = "",
|
||||||
flags = "ap",
|
flags = "aoebm",
|
||||||
desc = "Choose the clipboard brush",
|
desc = "Choose the clipboard brush",
|
||||||
help =
|
help =
|
||||||
"Chooses the clipboard brush.\n" +
|
"Chooses the clipboard brush.\n" +
|
||||||
@ -141,7 +141,8 @@ public class BrushCommands {
|
|||||||
"stood relative to the copied area when you copied it."
|
"stood relative to the copied area when you copied it."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.clipboard")
|
@CommandPermissions("worldedit.brush.clipboard")
|
||||||
public void clipboardBrush(Player player, LocalSession session, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException {
|
public void clipboardBrush(Player player, LocalSession session, @Switch('a') boolean ignoreAir, @Switch('o') boolean usingOrigin,
|
||||||
|
@Switch('e') boolean pasteEntities, @Switch('b') boolean pasteBiomes, @Switch('m') Mask sourceMask) throws WorldEditException {
|
||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
Clipboard clipboard = holder.getClipboard();
|
Clipboard clipboard = holder.getClipboard();
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ public class BrushCommands {
|
|||||||
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1);
|
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1);
|
||||||
|
|
||||||
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||||
tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");
|
tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, sourceMask), "worldedit.brush.clipboard");
|
||||||
|
|
||||||
player.print("Clipboard brush shape equipped.");
|
player.print("Clipboard brush shape equipped.");
|
||||||
}
|
}
|
||||||
|
@ -170,16 +170,14 @@ public class ClipboardCommands {
|
|||||||
Region region = clipboard.getRegion();
|
Region region = clipboard.getRegion();
|
||||||
|
|
||||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||||
PasteBuilder builder = holder
|
Operation operation = holder
|
||||||
.createPaste(editSession)
|
.createPaste(editSession)
|
||||||
.to(to)
|
.to(to)
|
||||||
.ignoreAirBlocks(ignoreAirBlocks)
|
.ignoreAirBlocks(ignoreAirBlocks)
|
||||||
.copyBiomes(pasteBiomes)
|
.copyBiomes(pasteBiomes)
|
||||||
.copyEntities(pasteEntities);
|
.copyEntities(pasteEntities)
|
||||||
if (sourceMask != null) {
|
.maskSource(sourceMask)
|
||||||
builder.maskSource(sourceMask);
|
.build();
|
||||||
}
|
|
||||||
Operation operation = builder.build();
|
|
||||||
Operations.completeLegacy(operation);
|
Operations.completeLegacy(operation);
|
||||||
|
|
||||||
if (selectPasted) {
|
if (selectPasted) {
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.tool.brush;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
@ -31,14 +32,30 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
|
|
||||||
public class ClipboardBrush implements Brush {
|
public class ClipboardBrush implements Brush {
|
||||||
|
|
||||||
private ClipboardHolder holder;
|
private final ClipboardHolder holder;
|
||||||
private boolean ignoreAirBlocks;
|
private final boolean ignoreAirBlocks;
|
||||||
private boolean usingOrigin;
|
private final boolean usingOrigin;
|
||||||
|
private final boolean pasteEntities;
|
||||||
|
private final boolean pasteBiomes;
|
||||||
|
private final Mask sourceMask;
|
||||||
|
|
||||||
public ClipboardBrush(ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin) {
|
public ClipboardBrush(ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin) {
|
||||||
this.holder = holder;
|
this.holder = holder;
|
||||||
this.ignoreAirBlocks = ignoreAirBlocks;
|
this.ignoreAirBlocks = ignoreAirBlocks;
|
||||||
this.usingOrigin = usingOrigin;
|
this.usingOrigin = usingOrigin;
|
||||||
|
this.pasteBiomes = false;
|
||||||
|
this.pasteEntities = false;
|
||||||
|
this.sourceMask = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClipboardBrush(ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin, boolean pasteEntities,
|
||||||
|
boolean pasteBiomes, Mask sourceMask) {
|
||||||
|
this.holder = holder;
|
||||||
|
this.ignoreAirBlocks = ignoreAirBlocks;
|
||||||
|
this.usingOrigin = usingOrigin;
|
||||||
|
this.pasteEntities = pasteEntities;
|
||||||
|
this.pasteBiomes = pasteBiomes;
|
||||||
|
this.sourceMask = sourceMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -51,6 +68,9 @@ public class ClipboardBrush implements Brush {
|
|||||||
.createPaste(editSession)
|
.createPaste(editSession)
|
||||||
.to(usingOrigin ? position : position.subtract(centerOffset))
|
.to(usingOrigin ? position : position.subtract(centerOffset))
|
||||||
.ignoreAirBlocks(ignoreAirBlocks)
|
.ignoreAirBlocks(ignoreAirBlocks)
|
||||||
|
.copyEntities(pasteEntities)
|
||||||
|
.copyBiomes(pasteBiomes)
|
||||||
|
.maskSource(sourceMask)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Operations.completeLegacy(operation);
|
Operations.completeLegacy(operation);
|
||||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
/**
|
/**
|
||||||
* Copies the biome from one extent to another.
|
* Copies the biome from one extent to another.
|
||||||
*/
|
*/
|
||||||
public class ExtentBiomeCopy implements FlatRegionFunction {
|
public class ExtentBiomeCopy implements FlatRegionFunction {
|
||||||
|
|
||||||
private final Extent source;
|
private final Extent source;
|
||||||
private final Extent destination;
|
private final Extent destination;
|
||||||
|
@ -83,6 +83,10 @@ public class PasteBuilder {
|
|||||||
* @return this builder instance
|
* @return this builder instance
|
||||||
*/
|
*/
|
||||||
public PasteBuilder maskSource(Mask sourceMask) {
|
public PasteBuilder maskSource(Mask sourceMask) {
|
||||||
|
if (sourceMask == null) {
|
||||||
|
this.sourceMask = Masks.alwaysTrue();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
this.sourceMask = sourceMask;
|
this.sourceMask = sourceMask;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren