Package net.minecraft.world.attribute
Record Class BackgroundMusic
java.lang.Object
java.lang.Record
net.minecraft.world.attribute.BackgroundMusic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BackgroundMusic> The field for thecreativeMusicrecord component.The field for thedefaultMusicrecord component.static final BackgroundMusicstatic final BackgroundMusicThe field for theunderwaterMusicrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionBackgroundMusic(Optional<Music> defaultMusic, Optional<Music> creativeMusic, Optional<Music> underwaterMusic) Creates an instance of aBackgroundMusicrecord class.BackgroundMusic(Holder<SoundEvent> p_457727_) BackgroundMusic(Music p_458216_) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecreativeMusicrecord component.Returns the value of thedefaultMusicrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.select(boolean pCreative, boolean pIsUnderwater) final StringtoString()Returns a string representation of this record class.Returns the value of theunderwaterMusicrecord component.withUnderwater(Music pUnderwaterMusic)
-
Field Details
-
defaultMusic
The field for thedefaultMusicrecord component. -
creativeMusic
The field for thecreativeMusicrecord component. -
underwaterMusic
The field for theunderwaterMusicrecord component. -
EMPTY
-
OVERWORLD
-
CODEC
-
-
Constructor Details
-
BackgroundMusic
-
BackgroundMusic
-
BackgroundMusic
public BackgroundMusic(Optional<Music> defaultMusic, Optional<Music> creativeMusic, Optional<Music> underwaterMusic) Creates an instance of aBackgroundMusicrecord class.- Parameters:
defaultMusic- the value for thedefaultMusicrecord componentcreativeMusic- the value for thecreativeMusicrecord componentunderwaterMusic- the value for theunderwaterMusicrecord component
-
-
Method Details
-
withUnderwater
-
select
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
defaultMusic
Returns the value of thedefaultMusicrecord component.- Returns:
- the value of the
defaultMusicrecord component
-
creativeMusic
Returns the value of thecreativeMusicrecord component.- Returns:
- the value of the
creativeMusicrecord component
-
underwaterMusic
Returns the value of theunderwaterMusicrecord component.- Returns:
- the value of the
underwaterMusicrecord component
-