Record Class EnchantmentTheme

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.EnchantmentTheme
Record Components:
name - The display name Component of the theme, used for localization and UI.
colorCode - An optional integer RGB color code (e.g., 0xFFFFFF) used for coloring UI elements, item prefixes, and enchantment names in tooltips.
powerProviders - A list of PowerProvider rules that specify which blocks contribute enchanting power for this theme and how much.
effects - An optional EffectData wrapper containing the particle and sound effects to spawn when this theme is dominant at the enchanting table or on a flying book.

public record EnchantmentTheme(net.minecraft.network.chat.Component name, Optional<Integer> colorCode, List<PowerProvider> powerProviders, Optional<EffectData> effects) extends Record
A data-driven record defining a complete "theme" for a set of related enchantments.

A theme controls the enchantment's metadata (display name and color), its generation logic (which nearby blocks provide thematic enchanting power), and its visual/auditory feedback at the Enchanting Altar and on flying book entities.

See Also:
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<EnchantmentTheme> CODEC
      The codec responsible for serializing and deserializing full instances of this record from data files (JSON).
    • NETWORK_CODEC

      public static final com.mojang.serialization.Codec<EnchantmentTheme> NETWORK_CODEC
      A lightweight network codec that omits powerProviders when synchronizing visual theme metadata to clients.
  • Constructor Details

    • EnchantmentTheme

      public EnchantmentTheme(net.minecraft.network.chat.Component name, Optional<Integer> colorCode, List<PowerProvider> powerProviders, Optional<EffectData> effects)
      Creates an instance of a EnchantmentTheme record class.
      Parameters:
      name - the value for the name record component
      colorCode - the value for the colorCode record component
      powerProviders - the value for the powerProviders record component
      effects - the value for the effects record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public net.minecraft.network.chat.Component name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • colorCode

      public Optional<Integer> colorCode()
      Returns the value of the colorCode record component.
      Returns:
      the value of the colorCode record component
    • powerProviders

      public List<PowerProvider> powerProviders()
      Returns the value of the powerProviders record component.
      Returns:
      the value of the powerProviders record component
    • effects

      public Optional<EffectData> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component