本文整理汇总了Java中com.sk89q.worldedit.function.operation.Operation类的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于com.sk89q.worldedit.function.operation包,在下文中一共展示了Operation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
/**
* Build the operation.
*
* @return the operation
*/
public Operation build() {
Extent extent = clipboard;
if (!transform.isIdentity()) {
extent = new BlockTransformExtent(extent, transform, targetWorldData.getBlockRegistry());
}
ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to);
copy.setTransform(transform);
copy.setCopyEntities(!ignoreEntities);
copy.setCopyBiomes((!ignoreBiomes) && (!(clipboard instanceof BlockArrayClipboard) || ((BlockArrayClipboard) clipboard).IMP.hasBiomes()));
if (this.canApply != null) {
copy.setFilterFunction(this.canApply);
}
if (targetExtent instanceof EditSession) {
Mask sourceMask = ((EditSession) targetExtent).getSourceMask();
if (sourceMask != null) {
new MaskTraverser(sourceMask).reset(extent);
copy.setSourceMask(sourceMask);
((EditSession) targetExtent).setSourceMask(null);
}
}
if (ignoreAirBlocks) {
copy.setSourceMask(new ExistingBlockMask(clipboard));
}
return copy;
}
示例2: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
public final
@Nullable
Operation commit() {
Operation ours = commitBefore();
Operation other = extent.commit();
if (ours != null && other != null) {
return new OperationQueue(ours, other);
} else if (ours != null) {
return ours;
} else if (other != null) {
return other;
} else {
return null;
}
}
示例3: pasteWithWE
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public static void pasteWithWE(Player p, File f) throws DataException {
SpongePlayer sp = SpongeWorldEdit.inst().wrapPlayer(p);
SpongeWorld ws = SpongeWorldEdit.inst().getWorld(p.getWorld());
LocalSession session = SpongeWorldEdit.inst().getSession(p);
Closer closer = Closer.create();
try {
ClipboardFormat format = ClipboardFormat.findByAlias("schematic");
FileInputStream fis = closer.register(new FileInputStream(f));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis);
WorldData worldData = ws.getWorldData();
Clipboard clipboard = reader.read(ws.getWorldData());
session.setClipboard(new ClipboardHolder(clipboard, worldData));
ClipboardHolder holder = session.getClipboard();
Operation op = holder.createPaste(session.createEditSession(sp), ws.getWorldData()).to(session.getPlacementPosition(sp)).build();
Operations.completeLegacy(op);
} catch (IOException | MaxChangedBlocksException | EmptyClipboardException | IncompleteRegionException e) {
e.printStackTrace();
}
}
示例4: runOperation
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
private static Operation runOperation(Operation operation, RunContext context) {
Operation next = operation;
while (next != null && context.shouldContinue()) {
try {
next = next.resume(context);
} catch (WorldEditException e) {
e.printStackTrace();
return null;
}
}
if (next != null) {
return next;
} else {
return null;
}
}
示例5: execute
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public Integer execute(ICancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 32768;
}
示例6: execute
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public Integer execute(CancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 0;
}
示例7: execute
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public Integer execute(CancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 32768;
}
示例8: regenerate
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
public void regenerate(Floor floor, EditSession session, RegenerationCause cause) {
Clipboard clipboard = floor.getClipboard();
Region region = clipboard.getRegion();
World world = region.getWorld();
WorldData data = world.getWorldData();
ClipboardHolder holder = new ClipboardHolder(clipboard, data);
Operation pasteOperation = holder.createPaste(session, data)
.to(region.getMinimumPoint())
.ignoreAirBlocks(true)
.build();
try {
Operations.complete(pasteOperation);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
}
示例9: generate
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
@Deprecated
public void generate(EditSession session) {
Region region = floorClipboard.getRegion();
World world = region.getWorld();
WorldData data = world.getWorldData();
ClipboardHolder holder = new ClipboardHolder(floorClipboard, data);
Operation pasteOperation = holder.createPaste(session, data)
.to(region.getMinimumPoint())
.ignoreAirBlocks(true)
.build();
try {
Operations.complete(pasteOperation);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
}
示例10: pasteBlocks
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
protected int pasteBlocks(Vector target, Vector offset, double angle) throws MaxChangedBlocksException {
RoundedTransform transform = new RoundedTransform(new AffineTransform()
.translate(offset)
.rotateY(angle));
if (!this.transform.isIdentity()) {
transform = transform.combine(this.transform);
}
if (!originalTransform.isIdentity()) {
transform = transform.combine(originalTransform);
}
// Pasting
Clipboard clipboard = clipboardHolder.getClipboard();
clipboard.setOrigin(center.subtract(centerOffset).round());
clipboardHolder.setTransform(transform);
Vector functionOffset = target.subtract(clipboard.getOrigin());
final int offX = functionOffset.getBlockX();
final int offY = functionOffset.getBlockY();
final int offZ = functionOffset.getBlockZ();
Operation operation = clipboardHolder
.createPaste(editSession, editSession.getWorldData())
.to(target)
.ignoreAirBlocks(true)
.filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ))
.build();
Operations.completeLegacy(operation);
// Cleanup
clipboardHolder.setTransform(originalTransform);
clipboard.setOrigin(originalOrigin);
return operation instanceof ForwardExtentCopy ? ((ForwardExtentCopy) operation).getAffected() : 0;
}
示例11: resume
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
public Operation resume(final RunContext run) throws WorldEditException {
while (this.iterator.hasNext()) {
if (this.function.apply(this.iterator.next())) {
affected++;
}
}
return null;
}
示例12: copyTo
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
/**
* Create an operation to copy from the original clipboard to the given extent.
*
* @param target the target
* @return the operation
*/
public Operation copyTo(Extent target) {
BlockTransformExtent extent = new BlockTransformExtent(original, transform, worldData.getBlockRegistry());
ForwardExtentCopy copy = new ForwardExtentCopy(extent, original.getRegion(), original.getOrigin(), target, original.getOrigin());
copy.setTransform(transform);
return copy;
}
示例13: SelectionCommand
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public SelectionCommand(CommandExecutor<Contextual<? extends Operation>> delegate, String permission) {
checkNotNull(delegate, "delegate");
checkNotNull(permission, "permission");
this.delegate = delegate;
this.permission = permission;
addParameter(delegate);
}
示例14: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public Operation commit() {
flush();
return null;
}
示例15: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Nullable
@Override
public Operation commit() {
return null;
}