Item.addEnchantment

Adds an enchantment to the item.

  1. void addEnchantment(Enchantment ench)
  2. void addEnchantment(sel.data.enchantment.Enchantment ench, ubyte level)
  3. void addEnchantment(sel.data.enchantment.Enchantment ench, string level)
    class Item
    @safe
    void
    addEnchantment
    (
    sel.data.enchantment.Enchantment ench
    ,
    string level
    )
  4. void opBinaryRight(Enchantment ench)

Throws

EnchantmentException if the enchantment doesn't exist

Examples

item.addEnchantment(new Enchantment(Enchantments.sharpness, 1));
item.addEnchantment(Enchantments.power, 5);
item.addEnchantment(Enchantments.fortune, "X");
item += new Enchantment(Enchantments.smite, 2);

Meta