Class EnchantmentLevelSetEvent
- java.lang.Object
-
- net.minecraftforge.eventbus.api.Event
-
- net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent
-
public class EnchantmentLevelSetEvent extends net.minecraftforge.eventbus.api.EventFired when the enchantment level is set for each of the three potential enchantments in the enchanting table. Thelevelis set to the vanilla value and can be modified by this event handler. TheenchantRowis used to determine which enchantment level is being set, 1, 2, or 3. Thepoweris a number from 0-15 and indicates how many bookshelves surround the enchanting table. TheitemStackrepresenting the item being enchanted is also available.
-
-
Field Summary
Fields Modifier and Type Field Description private intenchantRowprivate ItemStackitemStackprivate intlevelprivate intoriginalLevelprivate BlockPosposprivate intpowerprivate Worldworld
-
Constructor Summary
Constructors Constructor Description EnchantmentLevelSetEvent(World world, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int level)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetEnchantRow()Get the row for which the enchantment level is being setItemStackgetItem()Get the item being enchantedintgetLevel()Get the level of the enchantment for this row (0-30)intgetOriginalLevel()Get the original level of the enchantment for this row (0-30)BlockPosgetPos()Get the pos of the enchantment tableintgetPower()Get the power (# of bookshelves) for the enchanting tableWorldgetWorld()Get the world objectvoidsetLevel(int level)Set the new level of the enchantment (0-30)
-
-
-
Method Detail
-
getWorld
public World getWorld()
Get the world object- Returns:
- the world object
-
getPos
public BlockPos getPos()
Get the pos of the enchantment table- Returns:
- the pos of the enchantment table
-
getEnchantRow
public int getEnchantRow()
Get the row for which the enchantment level is being set- Returns:
- the row for which the enchantment level is being set
-
getPower
public int getPower()
Get the power (# of bookshelves) for the enchanting table- Returns:
- the power (# of bookshelves) for the enchanting table
-
getItem
@Nonnull public ItemStack getItem()
Get the item being enchanted- Returns:
- the item being enchanted
-
getOriginalLevel
public 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)
-
getLevel
public int getLevel()
Get the level of the enchantment for this row (0-30)- Returns:
- the level of the enchantment for this row (0-30)
-
setLevel
public void setLevel(int level)
Set the new level of the enchantment (0-30)- Parameters:
level- the new level of the enchantment (0-30)
-
-