Record Class MusicSound

java.lang.Object
java.lang.Record
net.minecraft.sound.MusicSound
Record Components:
sound -
minDelay -
maxDelay -
replaceCurrentMusic -

public record MusicSound(RegistryEntry<SoundEvent> sound, int minDelay, int maxDelay, boolean replaceCurrentMusic) extends Record
Mappings:
Namespace Name
named net/minecraft/sound/MusicSound
intermediary net/minecraft/class_5195
official ayw
named sound
intermediary comp_4358
official b
named minDelay
intermediary comp_4359
official c
named maxDelay
intermediary comp_4360
official d
named replaceCurrentMusic
intermediary comp_4361
official e
  • Field Details

    • sound

      private final RegistryEntry<SoundEvent> sound
      The field for the sound record component.
    • minDelay

      private final int minDelay
      The field for the minDelay record component.
    • maxDelay

      private final int maxDelay
      The field for the maxDelay record component.
    • replaceCurrentMusic

      private final boolean replaceCurrentMusic
      The field for the replaceCurrentMusic record component.
    • CODEC

      public static final com.mojang.serialization.Codec<MusicSound> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/sound/MusicSound;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_24627 Lnet/minecraft/class_5195;field_24627:Lcom/mojang/serialization/Codec;
      official a Layw;a:Lcom/mojang/serialization/Codec;
  • Constructor Details

    • MusicSound

      public MusicSound(RegistryEntry<SoundEvent> sound, int minDelay, int maxDelay, boolean replaceCurrentMusic)
      Creates an instance of a MusicSound record class.
      Parameters:
      sound - the value for the sound record component
      minDelay - the value for the minDelay record component
      maxDelay - the value for the maxDelay record component
      replaceCurrentMusic - the value for the replaceCurrentMusic 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 object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • sound

      public RegistryEntry<SoundEvent> sound()
      Returns the value of the sound record component.
      Returns:
      the value of the sound record component
    • minDelay

      public int minDelay()
      Returns the value of the minDelay record component.
      Returns:
      the value of the minDelay record component
    • maxDelay

      public int maxDelay()
      Returns the value of the maxDelay record component.
      Returns:
      the value of the maxDelay record component
    • replaceCurrentMusic

      public boolean replaceCurrentMusic()
      Returns the value of the replaceCurrentMusic record component.
      Returns:
      the value of the replaceCurrentMusic record component