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


Java Material.SHEARS属性代码示例

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


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

示例1: calcSurvivalFastBreak

public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
    if (isInstantBreak(block) || (tool.getType() == Material.SHEARS && block == Material.LEAVES)) {
        return 0;
    }
    double bhardness = BlockHardness.getBlockHardness(block);
    double thardness = ToolHardness.getToolHardness(tool.getType());
    long enchantlvl = (long) tool.getEnchantmentLevel(Enchantment.DIG_SPEED);

    long result = Math.round((bhardness * thardness) * 0.10 * 10000);

    if (enchantlvl > 0) {
        result /= enchantlvl * enchantlvl + 1L;
    }

    result = result > 25000 ? 25000 : result < 0 ? 0 : result;

    if (isQuickCombo(tool, block)) {
        result = result / 2;
    }

    return result;
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:22,代码来源:Utilities.java

示例2: onInteract

@EventHandler
public void onInteract(PlayerInteractEvent e) {
    final TOAUser u = TOA.getPlayer(e.getPlayer());

    if (e.getItem() != null) {
        Material m = e.getItem().getType();
        if (m == Material.WRITTEN_BOOK || m == Material.BOW || m == Material.SHEARS || m == Material.DIAMOND_SWORD) return;
        Ability.useAbility(u, e.getItem().getType());
        e.setCancelled(true);
    }

    if (!u.isOnRank(PACmd.Grupo.Builder)) {
        if (e.getClickedBlock() != null) {
            if (e.getClickedBlock().getType().equals(Material.TRAP_DOOR) || e.getClickedBlock().getType().equals(Material.IRON_TRAPDOOR)
                    || e.getClickedBlock().getType().equals(Material.FENCE_GATE) || e.getClickedBlock().getType().equals(Material.FIRE)
                    || e.getClickedBlock().getType().equals(Material.CAULDRON) || e.getClickedBlock().getRelative(BlockFace.UP).getType().equals(Material.FIRE)
                    || e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.TRAPPED_CHEST
                    || e.getClickedBlock().getType() == Material.DROPPER || e.getClickedBlock().getType() == Material.DISPENSER
                    || e.getClickedBlock().getType() == Material.BED_BLOCK || e.getClickedBlock().getType() == Material.BED
                    || e.getClickedBlock().getType() == Material.WORKBENCH || e.getClickedBlock().getType() == Material.BREWING_STAND
                    || e.getClickedBlock().getType() == Material.ANVIL || e.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE
                    || e.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE || e.getClickedBlock().getType() == Material.FURNACE
                    || e.getClickedBlock().getType() == Material.BURNING_FURNACE || e.getClickedBlock().getType() == Material.HOPPER
                    || e.getClickedBlock().getType() == Material.STONE_BUTTON || e.getClickedBlock().getType() == Material.WOOD_BUTTON) {
                e.setCancelled(true);
            }
        }
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:29,代码来源:GameEvents.java

示例3: isTool

static boolean isTool(ItemStack item) {
    if (item == null) return false;
    final Material material = item.getType();
    // shears
    if (material == Material.SHEARS) return true;
    // wood tools
    if (material == Material.WOOD_SWORD || material == Material.WOOD_AXE || material == Material.WOOD_HOE || material == Material.WOOD_PICKAXE || material == Material.WOOD_SPADE) {
        return true;
    }
    // stone tools
    if (material == Material.STONE_SWORD || material == Material.STONE_AXE || material == Material.STONE_HOE || material == Material.STONE_PICKAXE || material == Material.STONE_SPADE) {
        return true;
    }
    // iron tools
    if (material == Material.IRON_SWORD || material == Material.IRON_AXE || material == Material.IRON_HOE || material == Material.IRON_PICKAXE || material == Material.IRON_SPADE) {
        return true;
    }
    // gold tools
    if (material == Material.GOLD_SWORD || material == Material.GOLD_AXE || material == Material.GOLD_HOE || material == Material.GOLD_PICKAXE || material == Material.GOLD_SPADE) {
        return true;
    }
    // diamond tools
    if (material == Material.DIAMOND_SWORD || material == Material.DIAMOND_AXE || material == Material.DIAMOND_HOE || material == Material.DIAMOND_PICKAXE || material == Material.DIAMOND_SPADE) {
        return true;
    }
    return false;
}
 
开发者ID:Recraft,项目名称:Recreator,代码行数:27,代码来源:Item.java


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