本文整理汇总了Java中com.sk89q.worldedit.extent.clipboard.Clipboard类的典型用法代码示例。如果您正苦于以下问题:Java Clipboard类的具体用法?Java Clipboard怎么用?Java Clipboard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Clipboard类属于com.sk89q.worldedit.extent.clipboard包,在下文中一共展示了Clipboard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCompoundTag
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public void getCompoundTag(final String world, final Set<RegionWrapper> regions, final RunnableVal<CompoundTag> whenDone) {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
Location[] corners = MainUtil.getCorners(world, regions);
Location pos1 = corners[0];
Location pos2 = corners[1];
final CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
final EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
final int mx = pos1.getX();
final int my = pos1.getY();
final int mz = pos1.getZ();
ReadOnlyClipboard clipboard = ReadOnlyClipboard.of(editSession, region);
Clipboard holder = new BlockArrayClipboard(region, clipboard);
com.sk89q.jnbt.CompoundTag weTag = SchematicWriter.writeTag(holder);
CompoundTag tag = new CompoundTag((Map<String, Tag>) (Map<?, ?>) weTag.getValue());
whenDone.run(tag);
}
});
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:FaweSchematicHandler.java
示例2: apply
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
AffineTransform transform = new AffineTransform();
if (randomRotate) {
transform = transform.rotateY(PseudoRandom.random.random(4) * 90);
holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
}
if (randomFlip) {
transform = transform.scale(new Vector(1, 0, 0).multiply(-2).add(1, 1, 1));
}
if (!transform.isIdentity()) {
holder.setTransform(transform);
}
Clipboard clipboard = holder.getClipboard();
Schematic schematic = new Schematic(clipboard);
Transform newTransform = holder.getTransform();
if (newTransform.isIdentity()) {
schematic.paste(extent, setPosition, false);
} else {
schematic.paste(extent, worldData, setPosition, false, newTransform);
}
return true;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:RandomFullClipboardPattern.java
示例3: HeightBrush
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
public HeightBrush(InputStream stream, int rotation, double yscale, boolean layers, boolean smooth, Clipboard clipboard, ScalableHeightMap.Shape shape) {
this.rotation = (rotation / 90) % 4;
this.yscale = yscale;
this.layers = layers;
this.smooth = smooth;
if (stream != null) {
try {
heightMap = ScalableHeightMap.fromPNG(stream);
} catch (IOException e) {
throw new FaweException(BBC.BRUSH_HEIGHT_INVALID);
}
} else if (clipboard != null) {
heightMap = ScalableHeightMap.fromClipboard(clipboard);
} else {
heightMap = ScalableHeightMap.fromShape(shape);
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:HeightBrush.java
示例4: spawn
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public boolean spawn(PseudoRandom random, int x, int z) throws WorldEditException {
mutable.mutX(x);
mutable.mutZ(z);
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
if (y == -1) return false;
mutable.mutY(y);
if (!mask.test(mutable)) {
return false;
}
mutable.mutY(y + 1);
ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
if (randomRotate) {
holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
}
Clipboard clipboard = holder.getClipboard();
Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform();
if (transform.isIdentity()) {
schematic.paste(extent, mutable, false);
} else {
schematic.paste(extent, worldData, mutable, false, transform);
}
mutable.mutY(y);
return true;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:SchemGen.java
示例5: getClipboard
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
public Clipboard getClipboard() throws IOException {
try {
addDimensionReaders();
addBlockReaders();
readFully();
Vector min = new Vector(originX, originY, originZ);
Vector offset = new Vector(offsetX, offsetY, offsetZ);
Vector origin = min.subtract(offset);
Vector dimensions = new Vector(width, height, length);
fc.setDimensions(dimensions);
CuboidRegion region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
clipboard.init(region, fc);
clipboard.setOrigin(origin);
return clipboard;
} catch (Throwable e) {
if (fc != null) {
fc.close();
}
throw e;
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:SchematicStreamer.java
示例6: brush
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Command(
aliases = {"clipboard"},
usage = "",
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
help =
"Chooses the clipboard brush.\n" +
"The -a flag makes it not paste air.\n" +
"Without the -p flag, the paste will appear centered at the target location. " +
"With the flag, then the paste will appear relative to where you had " +
"stood relative to the copied area when you copied it."
)
@CommandPermissions("worldedit.brush.clipboard")
public BrushSettings clipboardBrush(Player player, LocalSession session, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin, CommandContext context) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard();
Vector size = clipboard.getDimensions();
worldEdit.checkMaxBrushRadius(size.getBlockX());
worldEdit.checkMaxBrushRadius(size.getBlockY());
worldEdit.checkMaxBrushRadius(size.getBlockZ());
return get(context).setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin));
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:BrushCommands.java
示例7: remap
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Command(
aliases = {"remap"},
help = "Remap a clipboard between MCPE/PC values\n",
desc = "Remap a clipboard between MCPE/PC values\n"
)
@Deprecated
@CommandPermissions({"worldedit.schematic.remap"})
public void remap(final Player player, final LocalSession session) throws WorldEditException {
ClipboardRemapper remapper;
if (Fawe.imp().getPlatform().equalsIgnoreCase("nukkit")) {
remapper = new ClipboardRemapper(ClipboardRemapper.RemapPlatform.PC, ClipboardRemapper.RemapPlatform.PE);
} else {
remapper = new ClipboardRemapper(ClipboardRemapper.RemapPlatform.PE, ClipboardRemapper.RemapPlatform.PC);
}
for (Clipboard clip : session.getClipboard().getClipboards()) {
remapper.apply(clip);
}
player.print(BBC.getPrefix() + "Remapped schematic");
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:21,代码来源:SchematicCommands.java
示例8: flip
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Command(
aliases = {"/flip"},
usage = "[<direction>]",
desc = "Flip the contents of the clipboard",
help =
"Flips the contents of the clipboard across the point from which the copy was made.\n",
min = 0,
max = 1
)
@CommandPermissions("worldedit.clipboard.flip")
public void flip(Player player, LocalSession session,
@Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard();
AffineTransform transform = new AffineTransform();
transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1));
holder.setTransform(transform.combine(holder.getTransform()));
BBC.COMMAND_FLIPPED.send(player);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:ClipboardCommands.java
示例9: pasteWithWE
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例10: execute
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例11: execute
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例12: execute
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例13: regenerate
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例14: loadClipboardFromDisk
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
/**
* Loads any history items from disk:
* - Should already be called if history on disk is enabled
*/
public void loadClipboardFromDisk() {
File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.CLIPBOARD + File.separator + getUUID() + ".bd");
try {
if (file.exists() && file.length() > 5) {
DiskOptimizedClipboard doc = new DiskOptimizedClipboard(file);
Player player = toWorldEditPlayer();
LocalSession session = getSession();
try {
if (session.getClipboard() != null) {
return;
}
} catch (EmptyClipboardException e) {
}
if (player != null && session != null) {
WorldData worldData = player.getWorld().getWorldData();
Clipboard clip = doc.toClipboard();
ClipboardHolder holder = new ClipboardHolder(clip, worldData);
getSession().setClipboard(holder);
}
}
} catch (Exception ignore) {
Fawe.debug("====== INVALID CLIPBOARD ======");
MainUtil.handleError(ignore, false);
Fawe.debug("===============---=============");
Fawe.debug("This shouldn't result in any failure");
Fawe.debug("File: " + file.getName() + " (len:" + file.length() + ")");
Fawe.debug("===============---=============");
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:34,代码来源:FawePlayer.java
示例15: pasteBlocks
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的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
示例16: fromClipboard
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
public static ScalableHeightMap fromClipboard(Clipboard clipboard) {
Vector dim = clipboard.getDimensions();
byte[][] heightArray = new byte[dim.getBlockX()][dim.getBlockZ()];
int minX = clipboard.getMinimumPoint().getBlockX();
int minZ = clipboard.getMinimumPoint().getBlockZ();
int minY = clipboard.getMinimumPoint().getBlockY();
int maxY = clipboard.getMaximumPoint().getBlockY();
int clipHeight = maxY - minY + 1;
HashSet<IntegerPair> visited = new HashSet<>();
for (Vector pos : clipboard.getRegion()) {
IntegerPair pair = new IntegerPair(pos.getBlockX(), pos.getBlockZ());
if (visited.contains(pair)) {
continue;
}
visited.add(pair);
int xx = pos.getBlockX();
int zz = pos.getBlockZ();
int highestY = minY;
for (int y = minY; y <= maxY; y++) {
pos.mutY(y);
BaseBlock block = clipboard.getBlock(pos);
if (block.getId() != 0) {
highestY = y + 1;
}
}
int pointHeight = Math.min(255, (256 * (highestY - minY)) / clipHeight);
int x = xx - minX;
int z = zz - minZ;
heightArray[x][z] = (byte) pointHeight;
}
return new ArrayHeightMap(heightArray);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:33,代码来源:ScalableHeightMap.java
示例17: MultiClipboardHolder
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
public MultiClipboardHolder(Clipboard clipboard, WorldData worldData) {
super(URI.create(""), EmptyClipboard.INSTANCE, worldData);
holders = new ArrayList<>();
URI uri = URI.create("");
if (clipboard instanceof BlockArrayClipboard) {
FaweClipboard fc = ((BlockArrayClipboard) clipboard).IMP;
if (fc instanceof DiskOptimizedClipboard) {
uri = ((DiskOptimizedClipboard) fc).getFile().toURI();
}
}
add(uri, clipboard);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:MultiClipboardHolder.java
示例18: contains
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public boolean contains(Clipboard clipboard) {
for (ClipboardHolder holder : holders) {
if (holder.contains(clipboard)) return true;
}
return false;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:MultiClipboardHolder.java
示例19: getClipboards
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public List<Clipboard> getClipboards() {
ArrayList<Clipboard> all = new ArrayList<>();
for (ClipboardHolder holder : holders) {
all.addAll(holder.getClipboards());
}
return all;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:9,代码来源:MultiClipboardHolder.java
示例20: getClipboard
import com.sk89q.worldedit.extent.clipboard.Clipboard; //导入依赖的package包/类
@Override
public Clipboard getClipboard() {
Clipboard[] available = cached;
if (available == null) {
cached = available = getClipboards().toArray(new Clipboard[0]);
}
switch (available.length) {
case 0: return EmptyClipboard.INSTANCE;
case 1: return available[0];
}
int index = PseudoRandom.random.nextInt(available.length);
return available[index];
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:MultiClipboardHolder.java
注:本文中的com.sk89q.worldedit.extent.clipboard.Clipboard类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论