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


Java BukkitUtil.toLocation方法代码示例

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


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

示例1: doUnloadChunkFlagWorldCheck

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
public static void doUnloadChunkFlagWorldCheck(World world)
{
	for (ProtectedRegion region : WorldGuardExtraFlagsPlugin.worldGuardPlugin.getRegionManager(world).getRegions().values())
	{
		if (region.getFlag(FlagUtils.CHUNK_UNLOAD) == State.DENY)
		{
			WorldGuardExtraFlagsPlugin.getPlugin().getLogger().info("Loading chunks for region " + region.getId() + " located in " + world.getName() + " due to chunk-unload flag being deny");
			
			Location min = BukkitUtil.toLocation(world, region.getMinimumPoint());
			Location max = BukkitUtil.toLocation(world, region.getMaximumPoint());

			for(int x = min.getChunk().getX(); x <= max.getChunk().getX(); x++)
			{
				for(int z = min.getChunk().getZ(); z <= max.getChunk().getZ(); z++)
				{
					world.getChunkAt(x, z).load(true);
				}
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:22,代码来源:WorldGuardExtraFlagsPlugin.java

示例2: calculateSpawnLocations

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
private void calculateSpawnLocations() {
	spawningBarriers.clear();
	
	for (Floor floor : game.getFloors()) {
		Region region = floor.getRegion();
		RegionIterator iterator = new RegionIterator(region);
		
		while (iterator.hasNext()) {
			BlockVector vector = iterator.next();
			Location location = BukkitUtil.toLocation(game.getWorld(), vector);
			Block block = location.getBlock();
			if (block.getType() != Material.BARRIER) {
				continue;
			}
			
			spawningBarriers.add(vector.add(0.5, 0.5, 0.5));
		}
	}
	
	Collections.shuffle(spawningBarriers);
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:22,代码来源:FlagShowBarriers.java

示例3: run

import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
@Override
public void run() {
	// do conversion once:
	if (!convertedToGlobal) {
		targetRegion = new CuboidRegion(parent.toGlobal(targetRegion.getPos1()), parent.toGlobal(targetRegion.getPos2()));
		convertedToGlobal = true;
	}
	
	// spawn as many entities as given by count:
	World world = parent.getPlugin().world;
	for (int nr=0; nr<grp.count; nr++) { 
		
		// use an individual random location, defined by the region of this task.
		// try for a given number of times to find a position not blocked. Give warning if not possible
		int tryNr = 1;
		Location spawnL = new Location(world, 0, 0, 0);
		while (tryNr < MAXSPAWNPOSITIONTRIES) {
			spawnL = BukkitUtil.toLocation(world, Helper.getRandVector(targetRegion));
			if (world.getBlockAt(spawnL).isEmpty()) break;
		}
		if (tryNr == MAXSPAWNPOSITIONTRIES) {
			parent.getPlugin().getLogger().warning("Entity could not be spawned: No free blocks within target region!");
			continue;
		}
		
		// Position is free if code reached here, so spawn:
		spawnL = spawnL.add(new org.bukkit.util.Vector(0.5,0,0.5)); // full qualified name again, meh// 0.5 added for world coord!
		Entity thisEnemy = world.spawnEntity(spawnL, grp.type);		// spawn and get pointer to track it
		if (grp.isTarget) parent.addTrackedEntity(thisEnemy); 		// add to List of tracked entities for BattleRooms to monitor
	}
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:32,代码来源:EntitySpawnTask.java


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