Record Class EffectData
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 of40means a1/40chance).particle- AnOptionalcontaining the specific parameters for particle spawning.sound- AnOptionalcontaining 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<EffectData> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionEffectData(int iterations, int chance, Optional<ParticleEffectData> particle, Optional<SoundEffectData> sound) Creates an instance of aEffectDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionintchance()Returns the value of thechancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theiterationsrecord component.particle()Returns the value of theparticlerecord component.sound()Returns the value of thesoundrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing instances of this record from JSON. Maps all four fields, withparticleandsoundbeing optional.
-
-
Constructor Details
-
EffectData
public EffectData(int iterations, int chance, Optional<ParticleEffectData> particle, Optional<SoundEffectData> sound) Creates an instance of aEffectDatarecord class.- Parameters:
iterations- the value for theiterationsrecord componentchance- the value for thechancerecord componentparticle- the value for theparticlerecord componentsound- the value for thesoundrecord 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
iterations
public int iterations()Returns the value of theiterationsrecord component.- Returns:
- the value of the
iterationsrecord component
-
chance
public int chance()Returns the value of thechancerecord component.- Returns:
- the value of the
chancerecord component
-
particle
Returns the value of theparticlerecord component.- Returns:
- the value of the
particlerecord component
-
sound
Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-