本文整理汇总了Java中com.sk89q.worldedit.function.operation.Operation类的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于com.sk89q.worldedit.function.operation包,在下文中一共展示了Operation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:31,代码来源:PasteBuilder.java
示例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;
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:AbstractDelegateExtent.java
示例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();
}
}
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:26,代码来源:WEListener.java
示例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;
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:18,代码来源:RunManager.java
示例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;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE330Adaptor.java
示例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;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE211Adaptor.java
示例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;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE311Adaptor.java
示例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);
}
}
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:22,代码来源:DefaultFloorRegenerator.java
示例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);
}
}
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:21,代码来源:SimpleClipboardFloor.java
示例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;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:37,代码来源:ClipboardSpline.java
示例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;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:EntityVisitor.java
示例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;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:FlattenedClipboardTransform.java
示例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);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:SelectionCommand.java
示例14: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
public Operation commit() {
flush();
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:AsyncWorld.java
示例15: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Nullable
@Override
public Operation commit() {
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:6,代码来源:PatternExtent.java
示例16: commitBefore
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
protected Operation commitBefore() {
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:NullExtent.java
示例17: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Nullable
public Operation commit() {
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:EmptyExtent.java
示例18: resume
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
public Operation resume(RunContext run) throws WorldEditException {
NodePair current;
Node from;
Node adjacent;
MutableBlockVector mutable = new MutableBlockVector();
Vector mutable2 = new Vector();
int countAdd, countAttempt;
IntegerTrio[] dirs = getIntDirections();
for (int layer = 0; !queue.isEmpty(); layer++) {
current = queue.poll();
from = current.to;
hashQueue.remove(from);
if (visited.containsKey(from)) {
continue;
}
mutable.mutX(from.getX());
mutable.mutY(from.getY());
mutable.mutZ(from.getZ());
function.apply(mutable);
countAdd = 0;
countAttempt = 0;
for (IntegerTrio direction : dirs) {
mutable2.mutX(from.getX() + direction.x);
mutable2.mutY(from.getY() + direction.y);
mutable2.mutZ(from.getZ() + direction.z);
if (isVisitable(mutable, mutable2)) {
adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ());
if ((current.from == null || !adjacent.equals(current.from))) {
AtomicInteger adjacentCount = visited.get(adjacent);
if (adjacentCount == null) {
if (countAdd++ < maxBranch) {
if (!hashQueue.contains(adjacent)) {
if (current.depth == maxDepth) {
countAttempt++;
} else {
hashQueue.add(adjacent);
queue.addFirst(new NodePair(from, adjacent, current.depth + 1));
}
} else {
countAttempt++;
}
} else {
countAttempt++;
}
} else if (adjacentCount.decrementAndGet() == 0) {
visited.remove(adjacent);
} else if (hashQueue.contains(adjacent)) {
countAttempt++;
}
}
}
}
if (countAttempt > 0) {
visited.put(from, new AtomicInteger(countAttempt));
}
affected++;
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:62,代码来源:DFSVisitor.java
示例19: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Nullable
@Override
default Operation commit() {
return getQueue().commit();
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:6,代码来源:IDelegateFaweQueue.java
示例20: commit
import com.sk89q.worldedit.function.operation.Operation; //导入依赖的package包/类
@Override
@Nullable
public Operation commit() {
return parent.commit();
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:6,代码来源:WorldWrapper.java
注:本文中的com.sk89q.worldedit.function.operation.Operation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论