Record Class SoundEffectData

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.effect.SoundEffectData
Record Components:
effect - A Holder referencing the SoundEvent to play (e.g., minecraft:particle.soul_escape).
volume - The base volume (0.0 to 1.0) for the sound.
volumeVariance - A random offset range added to or subtracted from the base volume.
pitch - The base pitch (0.0 to 2.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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<SoundEffectData>
    The codec responsible for serializing and deserializing instances of this record from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SoundEffectData(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect, float volume, float volumeVariance, float pitch, float pitchVariance)
    Creates an instance of a SoundEffectData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>
    Returns the value of the effect record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the pitch record component.
    float
    Returns the value of the pitchVariance record component.
    final String
    Returns a string representation of this record class.
    float
    Returns the value of the volume record component.
    float
    Returns the value of the volumeVariance record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<SoundEffectData> CODEC
      The codec responsible for serializing and deserializing instances of this record from JSON. Uses SoundEvent.CODEC to 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 a SoundEffectData record class.
      Parameters:
      effect - the value for the effect record component
      volume - the value for the volume record component
      volumeVariance - the value for the volumeVariance record component
      pitch - the value for the pitch record component
      pitchVariance - the value for the pitchVariance 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.
    • effect

      public net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> effect()
      Returns the value of the effect record component.
      Returns:
      the value of the effect record component
    • volume

      public float volume()
      Returns the value of the volume record component.
      Returns:
      the value of the volume record component
    • volumeVariance

      public float volumeVariance()
      Returns the value of the volumeVariance record component.
      Returns:
      the value of the volumeVariance record component
    • pitch

      public float pitch()
      Returns the value of the pitch record component.
      Returns:
      the value of the pitch record component
    • pitchVariance

      public float pitchVariance()
      Returns the value of the pitchVariance record component.
      Returns:
      the value of the pitchVariance record component