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


Java TreeType.JUNGLE属性代码示例

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


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

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