public interface Enchantment extends DataSerializable
EnchantmentType
on an ItemStack
that is paired
with a level.
The contract of enchantments is that their level will always be between
Short.MIN_VALUE
and Short.MAX_VALUE
, but it is not guaranteed
they will work properly outside of EnchantmentType.getMinimumLevel()
and EnchantmentType.getMaximumLevel()
.
Modifier and Type | Interface and Description |
---|---|
static interface |
Enchantment.Builder
Represents a builder interface which can be used
to create a
Enchantment . |
static interface |
Enchantment.RandomListBuilder
Represents a builder interface which can be used
to create a
Enchantment . |
Modifier and Type | Method and Description |
---|---|
static Enchantment.Builder |
builder()
Creates a new
Enchantment.Builder to create an Enchantment . |
int |
getLevel()
Gets the level of this enchantment.
|
EnchantmentType |
getType()
Gets the
EnchantmentType for this enchantment. |
static Enchantment |
of(EnchantmentType enchantmentType,
int level)
Creates a new
Enchantment with the provided
EnchantmentType and level. |
static Enchantment.RandomListBuilder |
randomListBuilder() |
getContentVersion, toContainer
static Enchantment.Builder builder()
Enchantment.Builder
to create an Enchantment
.static Enchantment.RandomListBuilder randomListBuilder()
static Enchantment of(EnchantmentType enchantmentType, int level) throws IllegalArgumentException
Enchantment
with the provided
EnchantmentType
and level.enchantmentType
- The enchantment typelevel
- The enchantment levelIllegalArgumentException
- If the level is smaller than
Short.MIN_VALUE
or larger than Short.MAX_VALUE
EnchantmentType getType()
EnchantmentType
for this enchantment.int getLevel()