當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.LEAVES_2屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.LEAVES_2屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.LEAVES_2屬性的具體用法?Java Material.LEAVES_2怎麽用?Java Material.LEAVES_2使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.LEAVES_2屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTreeGrow

/**
 * Prevents trees from growing outside of the protected area.
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (!Util.inWorld(e.getLocation())) {
        return;
    }
    // Check if this is on an island
    Island island = plugin.getIslands().getIslandAt(e.getLocation());
    if (island == null || island.isSpawn()) {
        return;
    }
    Iterator<BlockState> it = e.getBlocks().iterator();
    while (it.hasNext()) {
        BlockState b = it.next();
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
                || b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            if (!island.onIsland(b.getLocation())) {
                it.remove();
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:30,代碼來源:IslandGuard.java

示例2: onTreeGrow

/**
 * Converts trees to gravel and glowstone
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    if (!Settings.netherTrees) {
        return;
    }
    if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
        return;
    }
    // Check world
    if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
            b.setType(Material.GRAVEL);
        } else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            b.setType(Material.GLOWSTONE);
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:28,代碼來源:NetherEvents.java

示例3: isNearWood

public boolean isNearWood(Block block, int range)
{
    if(range <= 0)
        return false;

    for(BlockFace face : this.faces)
    {
        Block block1 = block.getRelative(face);

        if(block1.getType() == Material.LOG || block1.getType() == Material.LOG_2)
            return true;
        else if((block1.getType() == Material.LEAVES || block1.getType() == Material.LEAVES_2) && this.isNearWood(block1, range-1))
            return true;
    }

    return false;
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:17,代碼來源:FastTreeModule.java

示例4: getRandomLocation

public Location getRandomLocation(){
    int minX = corner1.getLocation().getBlockX();
    int minZ = corner1.getLocation().getBlockZ();
    int maxX = corner2.getLocation().getBlockX();
    int maxZ = corner2.getLocation().getBlockZ();

    double dx = Math.random() * (maxX - minX) + minX;
    double dz = Math.random() * (maxZ - minZ) + minZ;

    Block b = world.getHighestBlockAt(new Location(world, dx, 0, dz));

    if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) getRandomLocation();

    return b.getLocation();
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:15,代碼來源:CuboidRegion.java


注:本文中的org.bukkit.Material.LEAVES_2屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。