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


Java TreeType.REDWOOD属性代码示例

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


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

示例1: getTree

@SuppressWarnings("deprecation")
private TreeType getTree(Block block) {
	if (block.getType() == Material.SAPLING) {
		switch (block.getData()) {
		case 0:
			return TreeType.TREE;
		case 1:
			return TreeType.REDWOOD;
		case 2:
			return TreeType.BIRCH;
		case 3:
			return TreeType.SMALL_JUNGLE;
		case 4:
			return TreeType.ACACIA;
		case 5:
			return TreeType.DARK_OAK;
		}
		return TreeType.TREE;
	} else {
		if (block.getType() == Material.BROWN_MUSHROOM) {
			return TreeType.BROWN_MUSHROOM;
		} else {
			return TreeType.RED_MUSHROOM;
		}
	}
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:26,代码来源:Tree.java

示例2: run

@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
	TreeType tree;
	if (args.length < 1)
	{
		throw new NotEnoughArgumentsException();
	}
	else if (args[0].equalsIgnoreCase("birch"))
	{
		tree = TreeType.BIRCH;
	}
	else if (args[0].equalsIgnoreCase("redwood"))
	{
		tree = TreeType.REDWOOD;
	}
	else if (args[0].equalsIgnoreCase("tree"))
	{
		tree = TreeType.TREE;
	}
	else if (args[0].equalsIgnoreCase("redmushroom"))
	{
		tree = TreeType.RED_MUSHROOM;
	}
	else if (args[0].equalsIgnoreCase("brownmushroom"))
	{
		tree = TreeType.BROWN_MUSHROOM;
	}
	else if (args[0].equalsIgnoreCase("jungle"))
	{
		tree = TreeType.SMALL_JUNGLE;
	}
	else if (args[0].equalsIgnoreCase("junglebush"))
	{
		tree = TreeType.JUNGLE_BUSH;
	}
	else if (args[0].equalsIgnoreCase("swamp"))
	{
		tree = TreeType.SWAMP;
	}
	else
	{
		throw new NotEnoughArgumentsException();
	}

	final Location loc = LocationUtil.getTarget(user.getPlayer());
	final Location safeLocation = LocationUtil.getSafeDestination(loc);
	final boolean success = user.getPlayer().getWorld().generateTree(safeLocation, tree);
	if (success)
	{
		user.sendMessage(_("§6Tree spawned."));
	}
	else
	{
		user.sendMessage(_("§4Tree generation failure. Try again on grass or dirt."));
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:57,代码来源:Commandtree.java

示例3: populate

@Override
public void populate(World world, Random random, Chunk chunk) {
	int worldChunkX = chunk.getX();
	int worldChunkZ = chunk.getZ();
	TreeType[] treeTypes = new TreeType[] {};
	int treesPerChunk = 0;
	switch (world.getBiome(worldChunkX, worldChunkZ)) {
		case EXTREME_HILLS:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 1;
			break;
		case FOREST: case FOREST_HILLS:
			treeTypes = new TreeType[] {TreeType.TREE, TreeType.BIRCH};
			treesPerChunk = 8;
			break;
		case FROZEN_OCEAN:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 1;
			break;
		case FROZEN_RIVER:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 1;
			break;
		case ICE_MOUNTAINS:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 2;
			break;
		case ICE_PLAINS:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 1;
			break;
		case JUNGLE: case JUNGLE_HILLS:
			treeTypes = new TreeType[] {TreeType.JUNGLE, TreeType.SMALL_JUNGLE, TreeType.JUNGLE_BUSH};
			treesPerChunk = 4;
			break;
		case MUSHROOM_ISLAND: case MUSHROOM_SHORE:
			treeTypes = new TreeType[] {TreeType.RED_MUSHROOM, TreeType.BROWN_MUSHROOM};
			treesPerChunk = 4;
			break;
		case RIVER:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 4;
			break;
		case SMALL_MOUNTAINS:
			treeTypes = new TreeType[] {TreeType.TREE};
			treesPerChunk = 1;
			break;
		case SWAMPLAND:
			treeTypes = new TreeType[] {TreeType.SWAMP};
			break;
		case TAIGA: case TAIGA_HILLS:
			treeTypes = new TreeType[] {TreeType.REDWOOD, TreeType.TALL_REDWOOD};
			break;
		default:
			break;
	}
	if (treeTypes.length > 0 && treesPerChunk != 0) {
		for (int i = 0; i < treesPerChunk; i++) {
			world.generateTree(world.getHighestBlockAt(worldChunkX + random.nextInt(16), worldChunkZ + random.nextInt(16)).getLocation(), treeTypes[random.nextInt(treeTypes.length)]);
		}
	}
}
 
开发者ID:alyphen,项目名称:BukkitPopulators,代码行数:62,代码来源:BiomeTreePopulator.java


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