本文整理汇总了Java中com.sk89q.worldedit.world.registry.WorldData类的典型用法代码示例。如果您正苦于以下问题:Java WorldData类的具体用法?Java WorldData怎么用?Java WorldData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldData类属于com.sk89q.worldedit.world.registry包,在下文中一共展示了WorldData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paste
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
public void paste(Extent extent, WorldData worldData, Vector to, boolean pasteAir, Transform transform) {
checkNotNull(transform);
Region region = clipboard.getRegion();
Extent source = clipboard;
if (worldData != null && transform != null) {
source = new BlockTransformExtent(clipboard, transform, worldData.getBlockRegistry());
}
ForwardExtentCopy copy = new ForwardExtentCopy(source, clipboard.getRegion(), clipboard.getOrigin(), extent, to);
if (transform != null) {
copy.setTransform(transform);
}
copy.setCopyBiomes(!(clipboard instanceof BlockArrayClipboard) || ((BlockArrayClipboard) clipboard).IMP.hasBiomes());
if (extent instanceof EditSession) {
EditSession editSession = (EditSession) extent;
Mask sourceMask = editSession.getSourceMask();
if (sourceMask != null) {
new MaskTraverser(sourceMask).reset(extent);
copy.setSourceMask(sourceMask);
editSession.setSourceMask(null);
}
}
if (!pasteAir) {
copy.setSourceMask(new ExistingBlockMask(clipboard));
}
Operations.completeBlindly(copy);
}
示例2: pasteWithWE
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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();
}
}
示例3: execute
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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;
}
示例4: execute
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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;
}
示例5: execute
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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;
}
示例6: regenerate
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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);
}
}
示例7: generate
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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);
}
}
示例8: getWorldData
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
@Override
public WorldData getWorldData() {
try {
Class<?> wd = Class.forName("com.sk89q.worldedit.bukkit.BukkitWorldData");
Method methodInstance = wd.getDeclaredMethod("getInstance");
methodInstance.setAccessible(true);
return (WorldData) methodInstance.invoke(null);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
示例9: RandomFullClipboardPattern
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
public RandomFullClipboardPattern(Extent extent, WorldData worldData, List<ClipboardHolder> clipboards, boolean randomRotate, boolean randomFlip) {
checkNotNull(clipboards);
this.clipboards = clipboards;
this.extent = extent;
this.randomRotate = randomRotate;
this.worldData = worldData;
}
示例10: loadClipboardFromDisk
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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("===============---=============");
}
}
示例11: MultiClipboardHolder
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的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);
}
示例12: LazyClipboardHolder
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
/**
* Create a new instance with the given clipboard.
*
* @param worldData the mapping of blocks, entities, and so on
*/
public LazyClipboardHolder(URI uri, ByteSource source, ClipboardFormat format, WorldData worldData, UUID uuid) {
super(uri, EmptyClipboard.INSTANCE, worldData);
this.source = source;
this.format = format;
this.uuid = uuid != null ? uuid : UUID.randomUUID();
}
示例13: SchemGen
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
public SchemGen(Mask mask, Extent extent, WorldData worldData, List<ClipboardHolder> clipboards, boolean randomRotate) {
this.mask = mask;
this.extent = extent;
this.worldData = worldData;
this.clipboards = clipboards;
this.randomRotate = randomRotate;
}
示例14: mask
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
@Command(
aliases = {"schem", "schematic", "schems", "schematics", "addschems"},
usage = "[url] <mask> <file|folder|url> <rarity> <distance> <rotate=true>",
desc = "Populate schematics",
help = "Populate a schematic on the terrain\n" +
" - Change the mask (e.g. angle mask) to only place the schematic in specific locations.\n" +
" - The rarity is a value between 0 and 100.\n" +
" - The distance is the spacing between each schematic"
)
@CommandPermissions("worldedit.anvil.cfi")
public void schem(FawePlayer fp, @Optional BufferedImage imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate) throws ParameterException, IOException, WorldEditException {
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
World world = fp.getWorld();
WorldData wd = world.getWorldData();
MultiClipboardHolder multi = ClipboardFormat.SCHEMATIC.loadAllFromInput(fp.getPlayer(), wd, schematic, true);
if (multi == null) {
return;
}
if (imageMask == null) {
gen.addSchems(mask, wd, multi.getHolders(), rarity, distance, rotate);
} else {
gen.addSchems(imageMask, mask, wd, multi.getHolders(), rarity, distance, rotate);
}
msg("Added schematics!").send(fp);
populate(fp);
}
示例15: PasteBuilder
import com.sk89q.worldedit.world.registry.WorldData; //导入依赖的package包/类
/**
* Create a new instance.
*
* @param holder the clipboard holder
* @param targetExtent an extent
* @param targetWorldData world data of the target
*/
public PasteBuilder(ClipboardHolder holder, Extent targetExtent, WorldData targetWorldData) {
checkNotNull(holder);
checkNotNull(targetExtent);
checkNotNull(targetWorldData);
this.clipboard = holder.getClipboard();
this.worldData = holder.getWorldData();
this.transform = holder.getTransform();
this.targetExtent = targetExtent;
this.targetWorldData = targetWorldData;
}