Class EnchantmentLevelSetEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.enchanting.EnchantmentLevelSetEvent
public class EnchantmentLevelSetEvent
extends net.neoforged.bus.api.Event
Fired when the enchantment level is set for each of the three potential enchantments in the enchanting table.
 The 
level is set to the vanilla value and can be modified by this event handler.
 The enchantRow is used to determine which enchantment level is being set, 1, 2, or 3. The power is a number
 from 0-15 and indicates how many bookshelves surround the enchanting table. The itemStack representing the item being
 enchanted is also available.- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionEnchantmentLevelSetEvent(Level level, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int enchantLevel) 
- 
Method SummaryModifier and TypeMethodDescriptionintGet the level of the enchantment for this row (0-30)intGet the row for which the enchantment level is being setgetItem()Get the item being enchantedgetLevel()Get the world objectintGet the original level of the enchantment for this row (0-30)getPos()Get the pos of the enchantment tableintgetPower()Get the power (# of bookshelves) for the enchanting tablevoidsetEnchantLevel(int level) Set the new level of the enchantment (0-30)
- 
Field Details- 
level
- 
pos
- 
enchantRowprivate final int enchantRow
- 
powerprivate final int power
- 
itemStack
- 
originalLevelprivate final int originalLevel
- 
enchantLevelprivate int enchantLevel
 
- 
- 
Constructor Details- 
EnchantmentLevelSetEvent
 
- 
- 
Method Details- 
getLevelGet the world object- Returns:
- the world object
 
- 
getPosGet the pos of the enchantment table- Returns:
- the pos of the enchantment table
 
- 
getEnchantRowpublic int getEnchantRow()Get the row for which the enchantment level is being set- Returns:
- the row for which the enchantment level is being set
 
- 
getPowerpublic int getPower()Get the power (# of bookshelves) for the enchanting table- Returns:
- the power (# of bookshelves) for the enchanting table
 
- 
getItemGet the item being enchanted- Returns:
- the item being enchanted
 
- 
getOriginalLevelpublic int getOriginalLevel()Get the original level of the enchantment for this row (0-30)- Returns:
- the original level of the enchantment for this row (0-30)
 
- 
getEnchantLevelpublic int getEnchantLevel()Get the level of the enchantment for this row (0-30)- Returns:
- the level of the enchantment for this row (0-30)
 
- 
setEnchantLevelpublic void setEnchantLevel(int level) Set the new level of the enchantment (0-30)- Parameters:
- level- the new level of the enchantment (0-30)
 
 
-