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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<MagicSchool> The codec responsible for serializing and deserializingMagicSchooldefinitions from JSON.static final intThe default fallback color (0xFFFFFFFF, opaque white) used whencolorCodeis empty. -
Constructor Summary
ConstructorsConstructorDescriptionMagicSchool(String id, String translationKey, Optional<Integer> colorCode) Creates an instance of aMagicSchoolrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecolorCoderecord component.final booleanIndicates whether some other object is "equal to" this one.intgetColor()Resolves the integer color code of this magic school, falling back toDEFAULT_COLORif no explicit color code is defined.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetranslationKeyrecord component.
-
Field Details
-
DEFAULT_COLOR
public static final int DEFAULT_COLORThe default fallback color (0xFFFFFFFF, opaque white) used whencolorCodeis empty.- See Also:
-
CODEC
The codec responsible for serializing and deserializingMagicSchooldefinitions from JSON.
-
-
Constructor Details
-
MagicSchool
Creates an instance of aMagicSchoolrecord class.- Parameters:
id- the value for theidrecord componenttranslationKey- the value for thetranslationKeyrecord componentcolorCode- the value for thecolorCoderecord component
-
-
Method Details
-
getColor
public int getColor()Resolves the integer color code of this magic school, falling back toDEFAULT_COLORif no explicit color code is defined.- Returns:
- The integer color value.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
translationKey
Returns the value of thetranslationKeyrecord component.- Returns:
- the value of the
translationKeyrecord component
-
colorCode
Returns the value of thecolorCoderecord component.- Returns:
- the value of the
colorCoderecord component
-