Package net.fabricmc.fabric.api.item.v1
Enum Class EnchantingContext
- All Implemented Interfaces:
Serializable
,Comparable<EnchantingContext>
,Constable
An enum that describes the various contexts in which the game checks whether an enchantment can be applied to an item.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionWhen trying to apply an enchantment in an anvil.When using the/enchant
command.When randomly enchanting an item using theenchant_randomly
loot function without a list of enchantments to choose from.When generating a random enchantment for the item. -
Method Summary
Modifier and TypeMethodDescriptionstatic EnchantingContext
Returns the enum constant of this class with the specified name.static EnchantingContext[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RANDOM_ENCHANTMENT
When generating a random enchantment for the item. This includes the enchanting table, random mob equipment, and theenchant_with_levels
loot function.- See Also:
-
ANVIL
When trying to apply an enchantment in an anvil. -
ENCHANT_COMMAND
When using the/enchant
command. -
LOOT_RANDOM_ENCHANTMENT
When randomly enchanting an item using theenchant_randomly
loot function without a list of enchantments to choose from.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-