Record Class MagicSchool

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.school.MagicSchool
Record Components:
id - The internal string identifier of the magic school.
translationKey - The localization key used to display the school's name in tooltips and item titles.
colorCode - An optional integer RGB/ARGB color code used to tint particles, projectiles, and text.

public record MagicSchool(String id, String translationKey, Optional<Integer> colorCode) extends Record
A data-driven record representing a School of Magic in Enchanting Overhauled.

Schools of Magic categorize enchantments by their functional discipline (e.g., Abjuration, Obliteration, Perpetuation, Deception, Coercion, Divination, Conjuration, Translation, Transmutation) and govern item naming suffixes, particle/missile tinting, and AI spell selection affinities.

See Also:
  • Field Details

    • DEFAULT_COLOR

      public static final int DEFAULT_COLOR
      The default fallback color (0xFFFFFFFF, opaque white) used when colorCode is empty.
      See Also:
    • CODEC

      public static final com.mojang.serialization.Codec<MagicSchool> CODEC
      The codec responsible for serializing and deserializing MagicSchool definitions from JSON.
  • Constructor Details

    • MagicSchool

      public MagicSchool(String id, String translationKey, Optional<Integer> colorCode)
      Creates an instance of a MagicSchool record class.
      Parameters:
      id - the value for the id record component
      translationKey - the value for the translationKey record component
      colorCode - the value for the colorCode record component
  • Method Details

    • getColor

      public int getColor()
      Resolves the integer color code of this magic school, falling back to DEFAULT_COLOR if no explicit color code is defined.
      Returns:
      The integer color value.
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • translationKey

      public String translationKey()
      Returns the value of the translationKey record component.
      Returns:
      the value of the translationKey record component
    • colorCode

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