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


Java Material.CHORUS_PLANT属性代码示例

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


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

示例3: onBlockSpread

@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
	Block source = e.getSource();
	WorldChunk sourceChunk = CropControl.getDAO().getChunk(source.getChunk());
	int sourceX = source.getX();
	int sourceY = source.getY();
	int sourceZ = source.getZ();

	Block block = e.getBlock();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();

	if (!harvestableCrops.containsKey(source.getType()) && source.getType() != Material.CHORUS_FLOWER
			&& source.getType() != Material.CHORUS_PLANT && block.getType() != Material.CHORUS_FLOWER
			&& block.getType() != Material.CHORUS_PLANT)
		return;

	Crop sourceCrop = sourceChunk.getCrop(sourceX, sourceY, sourceZ);
	if (sourceCrop != null) {
		UUID placerUUID = sourceCrop.getPlacer();
		Crop.create(chunk, x, y, z, source.getType().toString(), null, placerUUID,
				System.currentTimeMillis(), true);
		return;
	} 
	
	TreeComponent treeComponent = sourceChunk.getTreeComponent(sourceX, sourceY, sourceZ);
	if (treeComponent != null) {
		treeComponent.setHarvestable(true);

		// TODO: should we differentiate between flower and plant here?
		TreeComponent.create(treeComponent.getTreeID(), chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				treeComponent.getPlacer(), true);
	}

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

示例4: returnUpwardsChorusBlocks

public Set<Location> returnUpwardsChorusBlocks(Block startBlock) {
	Set<Location> checkedLocations = new HashSet<Location>();

	Set<Location> uncheckedLocations = new HashSet<Location>();

	TreeComponent component = CropControl.getDAO().getChunk(startBlock.getChunk())
			.getTreeComponent(startBlock.getX(), startBlock.getY(), startBlock.getZ());
	if (component != null) {
		if (getTrackedTreeMaterial(component.getTreeType()) == Material.CHORUS_PLANT) {
			uncheckedLocations.add(startBlock.getLocation());
		}
	} else {
		return checkedLocations; // failfast
	}
	
	Tree tree = CropControl.getDAO().getTree(component);

	Set<Location> toAddLocations = new HashSet<Location>();
	do {
		for (Location unchecked : uncheckedLocations) {
			if (CropControl.getDAO().isTracked(unchecked.getBlock())
					&& !checkedLocations.contains(unchecked)) {
				checkedLocations.add(unchecked);
			}
		}

		for (Location location : uncheckedLocations) {
			for (BlockFace blockFace : CropControlEventHandler.growDirections) {
				Block relBlock = location.getBlock().getRelative(blockFace);
				Location rel = relBlock.getLocation();
				if (CropControl.getDAO().isTracked(relBlock)
						&& !toAddLocations.contains(rel)
						&& !checkedLocations.contains(rel)) {
					TreeComponent relComponent = CropControl.getDAO().getChunk(relBlock.getChunk())
							.getTreeComponent(relBlock.getX(), relBlock.getY(), relBlock.getZ());
					if (getTrackedTreeMaterial(relComponent.getTreeType()) == Material.CHORUS_PLANT
							&& CropControl.getDAO().isTreeComponent(tree, relComponent)) {
						toAddLocations.add(rel);
					}
				}
			}
		}

		uncheckedLocations.clear();

		uncheckedLocations.addAll(toAddLocations);

		toAddLocations.clear();

	} while (!uncheckedLocations.isEmpty());

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

示例5: isSolid

/**
 * Is the given block considered solid for flight-checks?
 * @param bk
 * @return solid
 */
private static boolean isSolid(Block bk) {
    Material type = bk.getType();
    return type.isSolid() || type == Material.CHORUS_PLANT || type == Material.CHORUS_FLOWER;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:9,代码来源:Flight.java


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