public final class ItemEnchantment extends Object implements DataSerializable
Enchantment
for an ItemStack
such that the pair
is created for an item. The contract of item enchantments is that the
Enchantment
's getLevel()
can never be lower than 0.Modifier and Type | Field and Description |
---|---|
static DataQuery |
ENCHANTMENT_ID |
static DataQuery |
LEVEL |
Constructor and Description |
---|
ItemEnchantment(Enchantment enchantment,
int level)
Creates a new
ItemEnchantment with the provided
Enchantment and level. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Enchantment |
getEnchantment()
Gets the
Enchantment for this ItemEnchantment . |
int |
getLevel()
Gets the level for this
ItemEnchantment . |
int |
hashCode() |
DataContainer |
toContainer()
Serializes this object into a comprehensible
DataContainer . |
public static final DataQuery ENCHANTMENT_ID
public static final DataQuery LEVEL
public ItemEnchantment(Enchantment enchantment, int level)
ItemEnchantment
with the provided
Enchantment
and level.enchantment
- The enchantmentlevel
- The level to pass inpublic Enchantment getEnchantment()
Enchantment
for this ItemEnchantment
.public int getLevel()
ItemEnchantment
.public DataContainer toContainer()
DataSerializable
DataContainer
.toContainer
in interface DataSerializable