本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}