当前位置: 首页>>代码示例>>Java>>正文


Java CuboidClipboard.paste方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.CuboidClipboard.paste方法的典型用法代码示例。如果您正苦于以下问题:Java CuboidClipboard.paste方法的具体用法?Java CuboidClipboard.paste怎么用?Java CuboidClipboard.paste使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.CuboidClipboard的用法示例。


在下文中一共展示了CuboidClipboard.paste方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: spawnTree

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
private void spawnTree(Location startBlock, String fileName, Vector offset){
	BukkitWorld world = new BukkitWorld(startBlock.getWorld());
	EditSession session = new EditSession(world, 1000);
	WorldEditPlugin wep = ((WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"));
	WorldEdit we = wep.getWorldEdit();
	LocalConfiguration config = we.getConfiguration();
	BukkitPlayer p = wep.wrapPlayer(startBlock.getWorld().getPlayers().get(0));
	File dir = we.getWorkingDirectoryFile(config.saveDir);
       File f;
       Vector v = new Vector(startBlock.getX(), startBlock.getY(), startBlock.getZ());
       
	try {
		f = we.getSafeOpenFile(p, dir, fileName, "schematic", "schematic");
		CuboidClipboard cc = SchematicFormat.MCEDIT.load(f);
		cc.setOffset(offset);
		
		cc.paste(session, v, true);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:22,代码来源:TreeListener.java

示例2: buildIsland

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
/**
 * Clean up all blocks in a location and paste the island schematic instead.
 *
 * @param loc1  Minimum point of the island.
 * @param loc2  Maximum point of the island.
 * @param world World to create the island in.
 * @param file  Schematic file to load.
 */
protected Region buildIsland(Vector loc1, Vector loc2, World world, File file) {
    try {
        EditSession editSession = instance.getEngineManager().getWorldEditUtils().getEditSession(world);
        editSession.enableQueue();
        Region region = LocationsParser.getRegion(loc1, loc2);
        // Replacing the blocks is MUCH faster than just setting them all to air.
        editSession.replaceBlocks(region, null, AIR);
        editSession.flushQueue();
        // Loading schematics.
        CuboidClipboard cuboidClipboard = instance.getEngineManager().getWorldEditUtils().getCuboidClipboard(file);
        // Pasting the schematic.
        cuboidClipboard.paste(editSession, region.getCenter(), false);
        editSession.flushQueue();
        // Cause pokemon is awesome.
        return region;
    } catch (Exception ex) {
        throw new RuntimeException("Problem with generating island.", ex);
    }
}
 
开发者ID:aaomidi,项目名称:JustSkyblock,代码行数:28,代码来源:IslandGeneration.java

示例3: place

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
/**
 * Place the waiting lobby in the world
 */
public void place()
{
    this.logger.info("Generating lobby...");

    if (this.file.exists())
    {
        try
        {
            Vector vector = new Vector(0, 190, 0);

            World world = Bukkit.getWorld("world");
            world.loadChunk(0, 0);

            BukkitWorld bwf = new BukkitWorld(world);

            this.editSession = new EditSession(bwf, -1);
            this.editSession.setFastMode(true);

            CuboidClipboard c1 = SchematicFormat.MCEDIT.load(this.file);
            c1.paste(this.editSession, vector, true);
        }
        catch (MaxChangedBlocksException | IOException | DataException ex)
        {
            this.logger.log(Level.SEVERE, "Error in world", ex);
        }

    }
    else
    {
        this.logger.severe("File does not exist. Abort...");
    }

    this.logger.info("Done.");
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:38,代码来源:LobbyPopulator.java

示例4: loadSchematic

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void loadSchematic(World world, int size, Vector v) throws Exception {
	if (getRandomCasa(size) == null) {
		return;
	}
	EditSession es = new EditSession(new BukkitWorld(world), Integer.MAX_VALUE);
	CuboidClipboard cc = CuboidClipboard.loadSchematic(getRandomCasa(size));
	cc.paste(es, v, false);
	cc.paste(es, v, false);
}
 
开发者ID:leonardosnt,项目名称:OldBukkit,代码行数:11,代码来源:TerrenosManager.java

示例5: pasteWithWE

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
public static void pasteWithWE(Player p, File file) {
	World world = p.getWorld();	
	Location loc = p.getLocation();
	
	EditSession es = new EditSession(new BukkitWorld(world), 999999999);		
	try {
		CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
		cc.paste(es, new com.sk89q.worldedit.Vector(loc.getX(),loc.getY(),loc.getZ()), false);
	} catch (DataException | IOException | MaxChangedBlocksException e) {
		e.printStackTrace();
	}		
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:13,代码来源:WEListener.java

示例6: regenerate

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
/**
 * Pastes a schematic into the room.
 */
private void regenerate() {
	try {
		Location location = sign.getLocation();
		CuboidClipboard clipboard = schematic.load(schematicFile);
		BukkitWorld world = new BukkitWorld(location.getWorld());
		WorldEditPlugin we = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
		EditSession editSession = we.getWorldEdit().getEditSessionFactory().getEditSession(world, 64*64*64);
		Vector newOrigin = region.getMinimumPoint();
		clipboard.paste(editSession, newOrigin, false);
	} catch (DataException | MaxChangedBlocksException | IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Co0sh,项目名称:RoomRent,代码行数:17,代码来源:SingleRoom.java

示例7: run

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
@Override
public void run(String playerID) throws QuestRuntimeException {
	try {
		Location location = loc.getLocation(playerID);
		SchematicFormat schematic = SchematicFormat.getFormat(file);
		CuboidClipboard clipboard = schematic.load(file);
		BukkitWorld world = new BukkitWorld(location.getWorld());
		EditSession editSession = we.getWorldEdit().getEditSessionFactory().getEditSession(world, 64*64*64);
		Vector newOrigin = BukkitUtil.toVector(location);
		clipboard.paste(editSession, newOrigin, noAir);
	} catch (DataException | IOException | MaxChangedBlocksException e) {
		Debug.error("Error while pasting a schematic: " + e.getMessage());
	}
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:15,代码来源:PasteSchematicEvent.java

示例8: placeFrame

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
public static boolean placeFrame(Location loc, CuboidClipboard clip, String localWorldName) {
        EditSessionFactory esf = new EditSessionFactory();
        EditSession es = esf.getEditSession(getLocalWorldByName(localWorldName), 65535);

        try {
//            clip.place(es, BukkitUtil.toVector(loc), false);
            clip.paste(es, BukkitUtil.toVector(loc), false);
            es.flushQueue();
            return true;
        } catch (MaxChangedBlocksException ex) {
            Logger.getLogger(WELoader.class.getName()).log(Level.SEVERE, null, ex);
        }
        return false;
    }
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:15,代码来源:WELoader.java

示例9: loadArea

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
private static void loadArea(World world, File file, Vector origin)
		throws DataException, IOException, MaxChangedBlocksException {
	SchematicFormat schematic = SchematicFormat.MCEDIT;
	CuboidClipboard clipboard = schematic.load(file);
	clipboard.paste(new EditSession(new BukkitWorld(world), 20000), origin,
			true);
}
 
开发者ID:mineglow-network,项目名称:HyperDriveCraft,代码行数:8,代码来源:Spacestation.java

示例10: paste

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private static boolean paste(String f, Location loc, Boolean exair, SchemFacingDirection facing) throws Exception {
	File file;

	if (f.startsWith("/")) {
		file = new File((f + ".schematic").replaceAll("/", Matcher.quoteReplacement(File.separator)));
	} else {
		file = new File(

				("plugins/WorldEdit/schematics/" + (f.contains(".") ? f
						: new StringBuilder(String.valueOf(f)).append(".schematic").toString())).replaceAll("/",
								Matcher.quoteReplacement(File.separator)));
	}
	Vector v = new Vector(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
	if ((!file.exists()) && (file.isDirectory())) {
		return false;
	}
	EditSession es = WorldEdit.getInstance().getEditSessionFactory()
			.getEditSession((new BukkitWorld(loc.getWorld())), 800000);

	CuboidClipboard cc = SchematicFormat.getFormat(file).load(file);
	try {

		if (facing != null) {

			if (SchemFacingDirection.getDegree(facing) != -1) {
				cc.rotate2D(SchemFacingDirection.getDegree(facing));
			} else {
				main core = (main) Bukkit.getPluginManager().getPlugin("SharpSK");
				core.getLogger().warning("Invalid rotation angle for schematic: " + "\"" + f + "\"");
				core.getLogger().warning("Valid angles are: 0, 90, 180, 270, 360");

			}
		}

	} catch (Exception e) {
		e.printStackTrace();
	}

	if (exair == false) {
		cc.paste(es, v, false);
	} else {
		cc.paste(es, v, true);
	}

	return true;

}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:49,代码来源:EffPasteSchematic.java

示例11: RestoreChunkFromDisk

import com.sk89q.worldedit.CuboidClipboard; //导入方法依赖的package包/类
public void RestoreChunkFromDisk()
{
	valubleBlockIds.add(41); 
	valubleBlockIds.add(42); 
	valubleBlockIds.add(57); 
	valubleBlockIds.add(113); 
	valubleBlockIds.add(138); 
	
	valubleBlockMaterials.add(Material.IRON_BLOCK);
	valubleBlockMaterials.add(Material.DIAMOND_BLOCK);
	valubleBlockMaterials.add(Material.GOLD_BLOCK);
	valubleBlockMaterials.add(Material.BEACON);
	valubleBlockMaterials.add(Material.EMERALD_BLOCK);
	
	ArrayList<BlockState> valubleBlocsToRmove = new ArrayList<BlockState>();
	
	if(schematicFile.exists() == false) return;		
	try
	{
		EditSession editSession = new EditSession(new BukkitWorld(chunk.getWorld()), 131073);
		CuboidClipboard clipboard = SchematicFormat.MCEDIT.load(schematicFile);
					
		Vector newvec = locationToVector(chunk.getBlock(0, 0, 0).getLocation());
		
		for(int y = 0; y < 256; y ++)
		{
			for(int z = 0; z < 16; z++)
			{
				for(int x = 0; x < 16 ; x++)
				{
					BaseBlock block = clipboard.getBlock(new Vector(x,y,z));
					Block existingBlock = chunk.getBlock(x, y, z);
					
					// if the schematic contains a valuable block at this position save what is currently there
					// that way we dont restore any valuable block and instead leave whatever was there before this command
					if(valubleBlockIds.contains(block.getId())) 
					{
						System.out.print("Valuable Block Detected" + block.getId());
						
						// we will revert the valuable block back to its post was state after the restore
						valubleBlocsToRmove.add(existingBlock.getState());
					}
					
					
					// of if the location has a valuable block save it
					else if(valubleBlockMaterials.contains(existingBlock.getType()))
					{
						System.out.print("Valuable Block Detected in current world");
						valubleBlocsToRmove.add(existingBlock.getState());
					}
				}
			}
		}
		
		HashMap<Integer,NationsContainer> PostWarContents = saveExistingChests(chunk);
		
		// paste twice it helps fix any rail issues
		clipboard.paste(editSession, newvec, false, true);
		clipboard.paste(editSession, newvec, false, true);		
		
		// revert any valuable blocks back to whatever they were before this command was executed
		for(BlockState bs : valubleBlocsToRmove)
		{
			System.out.print("Valuable Block Updated" + bs);
			bs.update(true);				
		}

		restoreChests(chunk, PostWarContents, brokenChests );
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	}
	
}
 
开发者ID:marsglorious,项目名称:NewNations,代码行数:76,代码来源:PlotRestoreManager.java


注:本文中的com.sk89q.worldedit.CuboidClipboard.paste方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。