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


Java TreeType.RED_MUSHROOM属性代码示例

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


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

示例1: getTrackedTreeMaterial

public Material getTrackedTreeMaterial(String trackedType) {
	if (Material.CHORUS_PLANT.toString().equals(trackedType))
		return Material.CHORUS_PLANT;
	else {
		for (TreeType treeType : TreeType.values()) {
			if (treeType.toString().equals(trackedType)) {
				if (treeType == TreeType.ACACIA || treeType == TreeType.DARK_OAK)
					return Material.LOG_2;
				else if (treeType == TreeType.BROWN_MUSHROOM)
					return Material.HUGE_MUSHROOM_1;
				else if (treeType == TreeType.RED_MUSHROOM)
					return Material.HUGE_MUSHROOM_2;
				else
					return Material.LOG;
			}
		}
	}
	CropControl.getPlugin().debug("Unable to match tracked tree type material {0}", trackedType);

	return null;
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:21,代码来源:CropControlEventHandler.java

示例2: grow

public boolean grow(World world, int i, int j, int k, Random random) {
    int l = world.getData(i, j, k);
    world.setAir(i, j, k);
    WorldGenHugeMushroom worldgenhugemushroom = null;

    if (this == Blocks.BROWN_MUSHROOM) {
        BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
        worldgenhugemushroom = new WorldGenHugeMushroom(0);
    } else if (this == Blocks.RED_MUSHROOM) {
        BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
        worldgenhugemushroom = new WorldGenHugeMushroom(1);
    }

    if (worldgenhugemushroom != null && worldgenhugemushroom.generate(world, random, i, j, k)) {
        return true;
    } else {
        world.setTypeAndData(i, j, k, this, l, 3);
        return false;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:20,代码来源:BlockMushroom.java

示例3: 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

示例4: c

public boolean c(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
    world.setAir(blockposition);
    WorldGenHugeMushroom worldgenhugemushroom = null;

    if (this == Blocks.BROWN_MUSHROOM) {
        BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
        worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
    } else if (this == Blocks.RED_MUSHROOM) {
        BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
        worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.RED_MUSHROOM_BLOCK);
    }

    if (worldgenhugemushroom != null && worldgenhugemushroom.generate(world, random, blockposition)) {
        return true;
    } else {
        world.setTypeAndData(blockposition, iblockdata, 3);
        return false;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:BlockMushroom.java

示例5: getTrackedTypeMaterial

public Material getTrackedTypeMaterial(String trackedType) {
	for (Material material : harvestableCrops.keySet()) {
		if (material.toString().equals(trackedType))
			return material;
	}

	if (Material.MELON_BLOCK.toString().equals(trackedType))
		return Material.MELON_BLOCK;
	else if (Material.PUMPKIN.toString().equals(trackedType))
		return Material.PUMPKIN;

	for (Byte i = 0; i < 6; i++) {
		if (getSaplingType(i).equals(trackedType)) // TODO: odd structure here
			return Material.SAPLING;
	}

	for (TreeType treeType : TreeType.values()) {
		if (treeType.toString().equals(trackedType)) {
			if (treeType == TreeType.ACACIA || treeType == TreeType.DARK_OAK)
				return Material.LOG_2;
			else if (treeType == TreeType.BROWN_MUSHROOM)
				return Material.HUGE_MUSHROOM_1;
			else if (treeType == TreeType.RED_MUSHROOM)
				return Material.HUGE_MUSHROOM_2;
			else
				return Material.LOG;
		}
	}

	if (Material.CHORUS_PLANT.toString().equals(trackedType))
		return Material.CHORUS_PLANT;

	CropControl.getPlugin().debug("Unable to match tracked type material {0}", trackedType);
	return null;
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:35,代码来源:CropControlEventHandler.java

示例6: 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

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