Enum Class EnchantmentSource

java.lang.Object
java.lang.Enum<EnchantmentSource>
johnsmith.enchantingoverhauled.api.enchantment.EnchantmentSource
All Implemented Interfaces:
Serializable, Comparable<EnchantmentSource>, Constable

public enum EnchantmentSource extends Enum<EnchantmentSource>
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:

  • TARGET: Upgrading an existing enchantment directly on the item being enchanted.
  • SOURCE: Transferring an enchantment from a catalyst item (e.g., an Enchanted Book, Page, or Tome) in the source slot.
  • TABLE: Applying a new, randomly rolled enchantment generated by the enchanting altar.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Represents 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

    Fields
    Modifier and Type
    Field
    Description
    final int
    The default text color when the slot is disabled.
    final net.minecraft.resources.Identifier
    The plain background texture used when the slot is disabled or unaffordable.
    final int
    The default text color when the slot is enabled.
    final net.minecraft.resources.Identifier
    The plain background texture used when the slot is enabled and affordable.
    final int
    The default text color when the slot is hovered.
    final net.minecraft.resources.Identifier
    The plain background texture used when the slot is hovered by the cursor.
    final String
    The internal string name of this source, used to construct texture paths.
  • Method Summary

    Modifier and Type
    Method
    Description
    byId(int id)
    Retrieves the EnchantmentSource enum constant matching the given integer ID.
    net.minecraft.resources.Identifier
    getDisabledTexture(int variant)
    Resolves the numbered variant texture for a disabled enchantment button of this source type.
    net.minecraft.resources.Identifier
    getEnabledTexture(int variant)
    Resolves the numbered variant texture for an enabled enchantment button of this source type.
    net.minecraft.resources.Identifier
    getHighlightedTexture(int variant)
    Resolves the numbered variant texture for a highlighted (hovered) enchantment button of this source type.
    int
    Retrieves the integer ID of this source type.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NONE

      public static final EnchantmentSource NONE
      Represents a null or uninitialized source (ID: -1).
    • TARGET

      public static final EnchantmentSource TARGET
      The enchantment originated from the Target item itself (for upgrading existing enchantments) (ID: 0).
    • SOURCE

      public static final EnchantmentSource SOURCE
      The enchantment originated from the Source item (e.g., a Tome) in the dedicated source slot (for transferring enchantments) (ID: 1).
    • TABLE

      public static final EnchantmentSource TABLE
      The enchantment is a new offering generated by the enchanting altar (ID: 2).
  • Field Details

    • name

      public final String name
      The internal string name of this source, used to construct texture paths.
    • enabledTexture

      public final net.minecraft.resources.Identifier enabledTexture
      The plain background texture used when the slot is enabled and affordable.
    • highlightedTexture

      public final net.minecraft.resources.Identifier highlightedTexture
      The plain background texture used when the slot is hovered by the cursor.
    • disabledTexture

      public final net.minecraft.resources.Identifier disabledTexture
      The plain background texture used when the slot is disabled or unaffordable.
    • enabledColor

      public final int enabledColor
      The default text color when the slot is enabled.
    • highlightedColor

      public final int highlightedColor
      The default text color when the slot is hovered.
    • disabledColor

      public final int disabledColor
      The default text color when the slot is disabled.
  • Method Details

    • values

      public static EnchantmentSource[] 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

      public static EnchantmentSource valueOf(String name)
      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 name
      NullPointerException - 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 (typically 0 through 9).
      Returns:
      The Identifier of 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 (typically 0 through 9).
      Returns:
      The Identifier of 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 (typically 0 through 9).
      Returns:
      The Identifier of the disabled button texture variant.
    • getId

      public int getId()
      Retrieves the integer ID of this source type.
      Returns:
      The unique integer ID.
    • byId

      public static EnchantmentSource byId(int id)
      Retrieves the EnchantmentSource enum constant matching the given integer ID.
      Parameters:
      id - The integer ID to look up.
      Returns:
      The corresponding EnchantmentSource constant, or NONE if the ID is -1.