Record Class EnchantmentTheme
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.EnchantmentTheme
- Record Components:
name- The display nameComponentof 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 ofPowerProviderrules that specify which blocks contribute enchanting power for this theme and how much.effects- An optionalEffectDatawrapper 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<EnchantmentTheme> The codec responsible for serializing and deserializing full instances of this record from data files (JSON).static final com.mojang.serialization.Codec<EnchantmentTheme> A lightweight network codec that omitspowerProviderswhen synchronizing visual theme metadata to clients. -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentTheme(net.minecraft.network.chat.Component name, Optional<Integer> colorCode, List<PowerProvider> powerProviders, Optional<EffectData> effects) Creates an instance of aEnchantmentThemerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecolorCoderecord component.effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.Returns the value of thepowerProvidersrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing full instances of this record from data files (JSON). -
NETWORK_CODEC
A lightweight network codec that omitspowerProviderswhen 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 aEnchantmentThemerecord class.- Parameters:
name- the value for thenamerecord componentcolorCode- the value for thecolorCoderecord componentpowerProviders- the value for thepowerProvidersrecord componenteffects- the value for theeffectsrecord component
-
-
Method Details
-
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). -
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
colorCode
Returns the value of thecolorCoderecord component.- Returns:
- the value of the
colorCoderecord component
-
powerProviders
Returns the value of thepowerProvidersrecord component.- Returns:
- the value of the
powerProvidersrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-