Item.opBinaryRight

Gets a pointer to the enchantment. This method can be used to check if the item has an enchantment and its level.

  1. void opBinaryRight(Enchantment ench)
  2. Enchantment* opBinaryRight(sel.data.enchantment.Enchantment ench)
    class Item
    @safe
    Enchantment*
    opBinaryRight
    (
    string op : "in"
    )
    (
    inout sel.data.enchantment.Enchantment ench
    )
  3. void opBinaryRight(sul.enchantments.Enchantment ench)

Examples

auto e = Enchantments.protection in item;
if(!e || e.level != 5) {
   item.enchant(Enchantment.protection, 5);
}
assert(Enchantments.protection in item);

Meta