Interface EnchantItemEvent.CalculateEnchantment

All Superinterfaces:
Cancellable, EnchantItemEvent, Event, InteractContainerEvent
Enclosing interface:
EnchantItemEvent

public static interface EnchantItemEvent.CalculateEnchantment extends EnchantItemEvent
Triggers when the enchantments for an item are calculated. This happens after a new item to enchant is put in the table and again when the item is enchanted.
  • Method Details

    • item

      The itemstack to enchant.
      Returns:
      the itemstack to enchant.
    • levelRequirement

      int levelRequirement()
      The final level requirement from EnchantItemEvent.CalculateLevelRequirement.

      In vanilla the maximum value is 30.

      Returns:
      the level requirement for the option
    • originalEnchantments

      List<Enchantment> originalEnchantments()
      Returns the original list of enchantments to apply to the item.

      The first item in the list is used for display when previewing the enchantments.

      Returns:
      the list of enchantments
    • enchantments

      List<Enchantment> enchantments()
      Returns the list of enchantments to apply to the item.

      The first item in the list is used for display when previewing the enchantments.

      Returns:
      the list of enchantments
    • setEnchantments

      void setEnchantments(List<Enchantment> enchantments)
      Sets the list of enchantments to apply to the item.

      The first item in the list is used for display when previewing the enchantments.

      Note that when modifying the enchantment list you should return the same enchantments for the same seed and option.

      See Enchantment.randomListBuilder() to generate enchantment lists.

      Parameters:
      enchantments - the new list of enchantments