Record Class SoundEffectData
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.effect.SoundEffectData
- Record Components:
effect- AHolderreferencing theSoundEventto play (e.g.,minecraft:particle.soul_escape).volume- The base volume (0.0to1.0) for the sound.volumeVariance- A random offset range added to or subtracted from the base volume.pitch- The base pitch (0.0to2.0) for the sound.pitchVariance- A random offset range added to or subtracted from the base pitch.
public record SoundEffectData(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect, float volume, float volumeVariance, float pitch, float pitchVariance)
extends Record
A data-driven record defining the audio properties for a sound event associated with an
EnchantmentTheme.
Specifies the sound to play and how its volume and pitch should be randomized upon emission.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SoundEffectData> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionSoundEffectData(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect, float volume, float volumeVariance, float pitch, float pitchVariance) Creates an instance of aSoundEffectDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatpitch()Returns the value of thepitchrecord component.floatReturns the value of thepitchVariancerecord component.final StringtoString()Returns a string representation of this record class.floatvolume()Returns the value of thevolumerecord component.floatReturns the value of thevolumeVariancerecord component.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing instances of this record from JSON. UsesSoundEvent.CODECto handle the sound event holder.
-
-
Constructor Details
-
SoundEffectData
public SoundEffectData(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect, float volume, float volumeVariance, float pitch, float pitchVariance) Creates an instance of aSoundEffectDatarecord class.- Parameters:
effect- the value for theeffectrecord componentvolume- the value for thevolumerecord componentvolumeVariance- the value for thevolumeVariancerecord componentpitch- the value for thepitchrecord componentpitchVariance- the value for thepitchVariancerecord 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 '=='. -
effect
public net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect()Returns the value of theeffectrecord component.- Returns:
- the value of the
effectrecord component
-
volume
public float volume()Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-
volumeVariance
public float volumeVariance()Returns the value of thevolumeVariancerecord component.- Returns:
- the value of the
volumeVariancerecord component
-
pitch
public float pitch()Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-
pitchVariance
public float pitchVariance()Returns the value of thepitchVariancerecord component.- Returns:
- the value of the
pitchVariancerecord component
-