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 SummaryNested classes/interfaces inherited from interface org.spongepowered.api.event.item.inventory.EnchantItemEventEnchantItemEvent.CalculateEnchantment, EnchantItemEvent.CalculateLevelRequirement, EnchantItemEvent.PostNested classes/interfaces inherited from interface org.spongepowered.api.event.item.inventory.container.InteractContainerEventInteractContainerEvent.Close, InteractContainerEvent.Open
- 
Method SummaryModifier 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 org.spongepowered.api.event.CancellableisCancelled, setCancelledMethods inherited from interface org.spongepowered.api.event.item.inventory.EnchantItemEventoption, seedMethods inherited from interface org.spongepowered.api.event.item.inventory.container.InteractContainerEventcontainer, cursorTransaction
- 
Method Details- 
itemItemStackSnapshot item()The itemstack to enchant.- Returns:
- the itemstack to enchant.
 
- 
levelRequirementint levelRequirement()The final level requirement fromEnchantItemEvent.CalculateLevelRequirement.In vanilla the maximum value is 30. - Returns:
- the level requirement for the option
 
- 
originalEnchantmentsList<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
 
- 
enchantmentsList<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
 
- 
setEnchantmentsSets 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
 
 
-