Java Code Examples for net.minecraft.enchantment.EnumEnchantmentType#BREAKABLE

The following examples show how to use net.minecraft.enchantment.EnumEnchantmentType#BREAKABLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemEnderTool.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment)
{
    if (enchantment.type == EnumEnchantmentType.ALL ||
        enchantment.type == EnumEnchantmentType.BREAKABLE)
    {
        return true;
    }

    switch (ToolType.fromStack(stackTool))
    {
        case SHOVEL:
        case PICKAXE:
            return enchantment.type == EnumEnchantmentType.DIGGER;

        case AXE:
            return enchantment.type == EnumEnchantmentType.WEAPON ||
                   enchantment.type == EnumEnchantmentType.DIGGER;

        case HOE:
        default:
            return false;
    }
}
 
Example 2
Source File: ItemFukumame.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
    if (enchantment.type == EnumEnchantmentType.BREAKABLE) {
        return true;
    }

    if (enchantment == Enchantments.POWER) {
        return true;
    }
    return super.canApplyAtEnchantingTable(stack, enchantment);
}
 
Example 3
Source File: ItemVoidPickaxe.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment)
{
    return enchantment.type == EnumEnchantmentType.ALL ||
           enchantment.type == EnumEnchantmentType.BREAKABLE ||
           enchantment.type == EnumEnchantmentType.DIGGER;
}
 
Example 4
Source File: ItemEnderSword.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment)
{
    return enchantment.type == EnumEnchantmentType.ALL ||
           enchantment.type == EnumEnchantmentType.BREAKABLE ||
           enchantment.type == EnumEnchantmentType.WEAPON;
}
 
Example 5
Source File: ItemEnderBow.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment)
{
    return enchantment.type == EnumEnchantmentType.ALL ||
           enchantment.type == EnumEnchantmentType.BREAKABLE;
}