Enum Class EnchantmentSource
- All Implemented Interfaces:
Serializable,Comparable<EnchantmentSource>,Constable
Defines the origin or source of an enchantment displayed in the custom Enchanting Altar GUI.
This enumeration is used by the EnchantmentMenu and its client-side widgets to distinguish
between the three potential actions when enchanting an item:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents a null or uninitialized source (ID:-1).The enchantment originated from the Source item (e.g., a Tome) in the dedicated source slot (for transferring enchantments) (ID:1).The enchantment is a new offering generated by the enchanting altar (ID:2).The enchantment originated from the Target item itself (for upgrading existing enchantments) (ID:0). -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intThe default text color when the slot is disabled.final net.minecraft.resources.IdentifierThe plain background texture used when the slot is disabled or unaffordable.final intThe default text color when the slot is enabled.final net.minecraft.resources.IdentifierThe plain background texture used when the slot is enabled and affordable.final intThe default text color when the slot is hovered.final net.minecraft.resources.IdentifierThe plain background texture used when the slot is hovered by the cursor.final StringThe internal string name of this source, used to construct texture paths. -
Method Summary
Modifier and TypeMethodDescriptionstatic EnchantmentSourcebyId(int id) Retrieves theEnchantmentSourceenum constant matching the given integer ID.net.minecraft.resources.IdentifiergetDisabledTexture(int variant) Resolves the numbered variant texture for a disabled enchantment button of this source type.net.minecraft.resources.IdentifiergetEnabledTexture(int variant) Resolves the numbered variant texture for an enabled enchantment button of this source type.net.minecraft.resources.IdentifiergetHighlightedTexture(int variant) Resolves the numbered variant texture for a highlighted (hovered) enchantment button of this source type.intgetId()Retrieves the integer ID of this source type.static EnchantmentSourceReturns the enum constant of this class with the specified name.static EnchantmentSource[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Represents a null or uninitialized source (ID:-1). -
TARGET
The enchantment originated from the Target item itself (for upgrading existing enchantments) (ID:0). -
SOURCE
The enchantment originated from the Source item (e.g., a Tome) in the dedicated source slot (for transferring enchantments) (ID:1). -
TABLE
The enchantment is a new offering generated by the enchanting altar (ID:2).
-
-
Field Details
-
name
The internal string name of this source, used to construct texture paths. -
enabledTexture
public final net.minecraft.resources.Identifier enabledTextureThe plain background texture used when the slot is enabled and affordable. -
highlightedTexture
public final net.minecraft.resources.Identifier highlightedTextureThe plain background texture used when the slot is hovered by the cursor. -
disabledTexture
public final net.minecraft.resources.Identifier disabledTextureThe plain background texture used when the slot is disabled or unaffordable. -
enabledColor
public final int enabledColorThe default text color when the slot is enabled. -
highlightedColor
public final int highlightedColorThe default text color when the slot is hovered. -
disabledColor
public final int disabledColorThe default text color when the slot is disabled.
-
-
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
-
getEnabledTexture
public net.minecraft.resources.Identifier getEnabledTexture(int variant) Resolves the numbered variant texture for an enabled enchantment button of this source type.- Parameters:
variant- The deterministic texture variant index (typically0through9).- Returns:
- The
Identifierof the enabled button texture variant.
-
getHighlightedTexture
public net.minecraft.resources.Identifier getHighlightedTexture(int variant) Resolves the numbered variant texture for a highlighted (hovered) enchantment button of this source type.- Parameters:
variant- The deterministic texture variant index (typically0through9).- Returns:
- The
Identifierof the highlighted button texture variant.
-
getDisabledTexture
public net.minecraft.resources.Identifier getDisabledTexture(int variant) Resolves the numbered variant texture for a disabled enchantment button of this source type.- Parameters:
variant- The deterministic texture variant index (typically0through9).- Returns:
- The
Identifierof the disabled button texture variant.
-
getId
public int getId()Retrieves the integer ID of this source type.- Returns:
- The unique integer ID.
-
byId
Retrieves theEnchantmentSourceenum constant matching the given integer ID.- Parameters:
id- The integer ID to look up.- Returns:
- The corresponding
EnchantmentSourceconstant, orNONEif the ID is-1.
-