public class EnchantmentLevelSetEvent extends Event
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.Event.HasResult, Event.Result
Constructor and Description |
---|
EnchantmentLevelSetEvent(World world,
BlockPos pos,
int enchantRow,
int power,
ItemStack itemStack,
int level) |
Modifier and Type | Method and Description |
---|---|
int |
getEnchantRow()
Get the row for which the enchantment level is being set
|
ItemStack |
getItem()
Get the item being enchanted
|
int |
getLevel()
Get the level of the enchantment for this row (0-30)
|
int |
getOriginalLevel()
Get the original level of the enchantment for this row (0-30)
|
BlockPos |
getPos()
Get the pos of the enchantment table
|
int |
getPower()
Get the power (# of bookshelves) for the enchanting table
|
World |
getWorld()
Get the world object
|
void |
setLevel(int level)
Set the new level of the enchantment (0-30)
|
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
public World getWorld()
public BlockPos getPos()
public int getEnchantRow()
public int getPower()
@Nonnull public ItemStack getItem()
public int getOriginalLevel()
public int getLevel()
public void setLevel(int level)
level
- the new level of the enchantment (0-30)