Interface EnchantItemEvent.CalculateEnchantment
- All Superinterfaces:
Cancellable, EnchantItemEvent, Event, InteractContainerEvent
- Enclosing interface:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface EnchantItemEvent
EnchantItemEvent.CalculateEnchantment, EnchantItemEvent.CalculateLevelRequirement, EnchantItemEvent.PostNested classes/interfaces inherited from interface InteractContainerEvent
InteractContainerEvent.Close, InteractContainerEvent.Open -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of enchantments to apply to the item.item()The itemstack to enchant.intThe final level requirement fromEnchantItemEvent.CalculateLevelRequirement.Returns the original list of enchantments to apply to the item.voidsetEnchantments(List<Enchantment> enchantments) Sets the list of enchantments to apply to the item.Methods inherited from interface Cancellable
isCancelled, setCancelledMethods inherited from interface EnchantItemEvent
option, seedMethods inherited from interface InteractContainerEvent
container, cursorTransaction
-
Method Details
-
item
-
levelRequirement
int levelRequirement()The final level requirement fromEnchantItemEvent.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
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
-