This commit is contained in:
Jesse Boyd 2019-06-29 02:35:41 +10:00
parent 5a67363a78
commit 8c44c532c4
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 11 additions and 12 deletions

View File

@ -113,7 +113,7 @@ public class ClipboardCommands extends MethodCommands {
desc = "Lazily copy the selection to the clipboard", desc = "Lazily copy the selection to the clipboard",
help = "Lazily copy the selection to the clipboard\n" + help = "Lazily copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e will also copy entities\n" + " -e skips copying entities\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Pasting entities cannot yet be undone!", "WARNING: Pasting entities cannot yet be undone!",
@ -121,7 +121,7 @@ public class ClipboardCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.clipboard.lazycopy") @CommandPermissions("worldedit.clipboard.lazycopy")
public void lazyCopy(Player player, LocalSession session, EditSession editSession, public void lazyCopy(Player player, LocalSession session, EditSession editSession,
@Selection final Region region, @Switch('e') boolean copyEntities, @Selection final Region region, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -135,7 +135,7 @@ public class ClipboardCommands extends MethodCommands {
final int mx = origin.getBlockX(); final int mx = origin.getBlockX();
final int my = origin.getBlockY(); final int my = origin.getBlockY();
final int mz = origin.getBlockZ(); final int mz = origin.getBlockZ();
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, copyEntities, copyBiomes); ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
clipboard.setOrigin(session.getPlacementPosition(player)); clipboard.setOrigin(session.getPlacementPosition(player));
@ -152,7 +152,7 @@ public class ClipboardCommands extends MethodCommands {
desc = "Copy the selection to the clipboard", desc = "Copy the selection to the clipboard",
help = "Copy the selection to the clipboard\n" + help = "Copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e will also copy entities\n" + " -e skips copying entities\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Pasting entities cannot yet be undone!", "WARNING: Pasting entities cannot yet be undone!",
@ -161,7 +161,7 @@ public class ClipboardCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.clipboard.copy") @CommandPermissions("worldedit.clipboard.copy")
public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Switch('e') boolean copyEntities, @Selection Region region, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -178,7 +178,7 @@ public class ClipboardCommands extends MethodCommands {
clipboard.setOrigin(pos); clipboard.setOrigin(pos);
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setCopyingEntities(copyEntities); copy.setCopyingEntities(!skipEntities);
copy.setCopyBiomes(copyBiomes); copy.setCopyBiomes(copyBiomes);
Mask sourceMask = editSession.getSourceMask(); Mask sourceMask = editSession.getSourceMask();
if (sourceMask != null) { if (sourceMask != null) {
@ -242,7 +242,7 @@ public class ClipboardCommands extends MethodCommands {
desc = "Cut the selection to the clipboard", desc = "Cut the selection to the clipboard",
help = "Copy the selection to the clipboard\n" + help = "Copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e will also cut entities\n" + " -e skips entity copy\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Cutting and pasting entities cannot yet be undone!", "WARNING: Cutting and pasting entities cannot yet be undone!",
@ -251,7 +251,7 @@ public class ClipboardCommands extends MethodCommands {
@CommandPermissions("worldedit.clipboard.cut") @CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION) @Logging(REGION)
public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities, @Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -270,7 +270,7 @@ public class ClipboardCommands extends MethodCommands {
clipboard.setOrigin(pos); clipboard.setOrigin(pos);
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
copy.setCopyingEntities(copyEntities); copy.setCopyingEntities(!skipEntities);
copy.setRemovingEntities(true); copy.setRemovingEntities(true);
copy.setCopyBiomes(copyBiomes); copy.setCopyBiomes(copyBiomes);
Mask sourceMask = editSession.getSourceMask(); Mask sourceMask = editSession.getSourceMask();

View File

@ -53,6 +53,7 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.entity.EntityTypes; import com.sk89q.worldedit.world.entity.EntityTypes;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -365,7 +366,7 @@ public class ForwardExtentCopy implements Operation {
.filter(e -> e.getType() != EntityTypes.PLAYER) .filter(e -> e.getType() != EntityTypes.PLAYER)
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
entities = new ArrayList<>(); entities = Collections.emptyList();
} }
@ -374,8 +375,6 @@ public class ForwardExtentCopy implements Operation {
if (!entities.isEmpty()) { if (!entities.isEmpty()) {
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform); ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
// if (copyingEntities) {
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
entityCopy.setRemoving(removingEntities); entityCopy.setRemoving(removingEntities);
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy); EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
Operations.completeBlindly(entityVisitor); Operations.completeBlindly(entityVisitor);