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

The following examples show how to use net.minecraft.enchantment.EnumEnchantmentType#WEAPON . 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: ItemShinai.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
    if (enchantment.type == EnumEnchantmentType.WEAPON) {
        return true;
    }

    return super.canApplyAtEnchantingTable(stack, enchantment);
}
 
Example 3
Source File: ItemKotachi.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
    if (enchantment.type == EnumEnchantmentType.WEAPON) {
        return true;
    }

    return super.canApplyAtEnchantingTable(stack, enchantment);
}
 
Example 4
Source File: ItemKatana.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
    if (enchantment.type == EnumEnchantmentType.WEAPON) {
        return true;
    }

    return super.canApplyAtEnchantingTable(stack, enchantment);
}
 
Example 5
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 6
Source File: EnchantmentEnderDamage.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
private EnchantmentEnderDamage() {
    super(Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND});
}
 
Example 7
Source File: GTItemTeslaStaff.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnumEnchantmentType getType(ItemStack item) {
	return EnumEnchantmentType.WEAPON;
}
 
Example 8
Source File: EnchantmentWitherWeapon.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
public EnchantmentWitherWeapon() {
  super(Config.enchantmentWitherWeaponRarity, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND, EntityEquipmentSlot.OFFHAND});    
  setName(NAME);
  setRegistryName(NAME);

}