java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.effect.EffectData
Record Components:
iterations - The number of times per tick the game should attempt to spawn an effect for an active theme.
chance - The inverse probability of an effect successfully spawning on each attempt, expressed as "1 in X" (e.g., a value of 40 means a 1/40 chance).
particle - An Optional containing the specific parameters for particle spawning.
sound - An Optional containing the specific parameters for sound playback.

public record EffectData(int iterations, int chance, Optional<ParticleEffectData> particle, Optional<SoundEffectData> sound) extends Record
A data-driven record serving as a wrapper to define the visual and auditory effects associated with an EnchantmentTheme.

Controls the spawn rate and properties of both particles and sounds emitted by an active Enchanting Altar, its thematic power providers, or flying arcane books.

  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<EffectData> CODEC
      The codec responsible for serializing and deserializing instances of this record from JSON. Maps all four fields, with particle and sound being optional.
  • Constructor Details

    • EffectData

      public EffectData(int iterations, int chance, Optional<ParticleEffectData> particle, Optional<SoundEffectData> sound)
      Creates an instance of a EffectData record class.
      Parameters:
      iterations - the value for the iterations record component
      chance - the value for the chance record component
      particle - the value for the particle record component
      sound - the value for the sound 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • iterations

      public int iterations()
      Returns the value of the iterations record component.
      Returns:
      the value of the iterations record component
    • chance

      public int chance()
      Returns the value of the chance record component.
      Returns:
      the value of the chance record component
    • particle

      public Optional<ParticleEffectData> particle()
      Returns the value of the particle record component.
      Returns:
      the value of the particle record component
    • sound

      public Optional<SoundEffectData> sound()
      Returns the value of the sound record component.
      Returns:
      the value of the sound record component