Record Class BackgroundMusic

java.lang.Object
java.lang.Record
net.minecraft.world.attribute.BackgroundMusic
Record Components:
defaultMusic -
creativeMusic -
underwaterMusic -

public record BackgroundMusic(Optional<MusicSound> defaultMusic, Optional<MusicSound> creativeMusic, Optional<MusicSound> underwaterMusic) extends Record
Mappings:
Namespace Name
named net/minecraft/world/attribute/BackgroundMusic
intermediary net/minecraft/class_12194
official cdw
named defaultMusic
intermediary comp_5133
official d
named creativeMusic
intermediary comp_5134
official e
named underwaterMusic
intermediary comp_5135
official f
  • Field Details

    • defaultMusic

      private final Optional<MusicSound> defaultMusic
      The field for the defaultMusic record component.
    • creativeMusic

      private final Optional<MusicSound> creativeMusic
      The field for the creativeMusic record component.
    • underwaterMusic

      private final Optional<MusicSound> underwaterMusic
      The field for the underwaterMusic record component.
    • EMPTY

      public static final BackgroundMusic EMPTY
      Mappings:
      Namespace Name Mixin selector
      named EMPTY Lnet/minecraft/world/attribute/BackgroundMusic;EMPTY:Lnet/minecraft/world/attribute/BackgroundMusic;
      intermediary field_63700 Lnet/minecraft/class_12194;field_63700:Lnet/minecraft/class_12194;
      official a Lcdw;a:Lcdw;
    • DEFAULT

      public static final BackgroundMusic DEFAULT
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT Lnet/minecraft/world/attribute/BackgroundMusic;DEFAULT:Lnet/minecraft/world/attribute/BackgroundMusic;
      intermediary field_63701 Lnet/minecraft/class_12194;field_63701:Lnet/minecraft/class_12194;
      official b Lcdw;b:Lcdw;
    • CODEC

      public static final com.mojang.serialization.Codec<BackgroundMusic> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/world/attribute/BackgroundMusic;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_63702 Lnet/minecraft/class_12194;field_63702:Lcom/mojang/serialization/Codec;
      official c Lcdw;c:Lcom/mojang/serialization/Codec;
  • Constructor Details

    • BackgroundMusic

      public BackgroundMusic(MusicSound defaultMusic)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/world/attribute/BackgroundMusic;<init>(Lnet/minecraft/sound/MusicSound;)V
      intermediary <init> Lnet/minecraft/class_12194;<init>(Lnet/minecraft/class_5195;)V
      official <init> Lcdw;<init>(Lbcw;)V
    • BackgroundMusic

      public BackgroundMusic(RegistryEntry<SoundEvent> defaultMusic)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/world/attribute/BackgroundMusic;<init>(Lnet/minecraft/registry/entry/RegistryEntry;)V
      intermediary <init> Lnet/minecraft/class_12194;<init>(Lnet/minecraft/class_6880;)V
      official <init> Lcdw;<init>(Ljd;)V
    • BackgroundMusic

      public BackgroundMusic(Optional<MusicSound> defaultMusic, Optional<MusicSound> creativeMusic, Optional<MusicSound> underwaterMusic)
      Creates an instance of a BackgroundMusic record class.
      Parameters:
      defaultMusic - the value for the defaultMusic record component
      creativeMusic - the value for the creativeMusic record component
      underwaterMusic - the value for the underwaterMusic record component
  • Method Details

    • withUnderwater

      public BackgroundMusic withUnderwater(MusicSound underwater)
      Mappings:
      Namespace Name Mixin selector
      named withUnderwater Lnet/minecraft/world/attribute/BackgroundMusic;withUnderwater(Lnet/minecraft/sound/MusicSound;)Lnet/minecraft/world/attribute/BackgroundMusic;
      intermediary method_75638 Lnet/minecraft/class_12194;method_75638(Lnet/minecraft/class_5195;)Lnet/minecraft/class_12194;
      official a Lcdw;a(Lbcw;)Lcdw;
    • getCurrent

      public Optional<MusicSound> getCurrent(boolean creative, boolean underwater)
      Mappings:
      Namespace Name Mixin selector
      named getCurrent Lnet/minecraft/world/attribute/BackgroundMusic;getCurrent(ZZ)Ljava/util/Optional;
      intermediary method_75640 Lnet/minecraft/class_12194;method_75640(ZZ)Ljava/util/Optional;
      official a Lcdw;a(ZZ)Ljava/util/Optional;
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • defaultMusic

      public Optional<MusicSound> defaultMusic()
      Returns the value of the defaultMusic record component.
      Returns:
      the value of the defaultMusic record component
    • creativeMusic

      public Optional<MusicSound> creativeMusic()
      Returns the value of the creativeMusic record component.
      Returns:
      the value of the creativeMusic record component
    • underwaterMusic

      public Optional<MusicSound> underwaterMusic()
      Returns the value of the underwaterMusic record component.
      Returns:
      the value of the underwaterMusic record component