Record Class BackgroundMusic
java.lang.Object
java.lang.Record
fr.fidorial.world.environment.BackgroundMusic
- Record Components:
normal- track played by default, ornullfor silence — thedefaultfield on the wire, renamed here becausedefaultis a Java keywordunderwater- track overridingnormalwhile the player is submerged, ornullcreative- track overridingnormalin Creative mode, ornull
public record BackgroundMusic(@Nullable MusicTrack normal, @Nullable MusicTrack underwater, @Nullable MusicTrack creative)
extends Record
The
minecraft:audio/background_music environment attribute.
Since 1.21.11 this replaced the weighted music list biomes used to carry: instead of picking randomly among several tracks, the client picks the variant matching the player's situation.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionBackgroundMusic(@Nullable MusicTrack normal, @Nullable MusicTrack underwater, @Nullable MusicTrack creative) Creates an instance of aBackgroundMusicrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncreative()Returns the value of thecreativerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.normal()Returns the value of thenormalrecord component.static BackgroundMusicof(MusicTrack track) Creates an attribute carrying a single track for every situation.final StringtoString()Returns a string representation of this record class.Returns the value of theunderwaterrecord component.
-
Constructor Details
-
BackgroundMusic
public BackgroundMusic(@Nullable MusicTrack normal, @Nullable MusicTrack underwater, @Nullable MusicTrack creative) Creates an instance of aBackgroundMusicrecord class.- Parameters:
normal- the value for thenormalrecord componentunderwater- the value for theunderwaterrecord componentcreative- the value for thecreativerecord component
-
-
Method Details
-
of
Creates an attribute carrying a single track for every situation.- Parameters:
track- the track- Returns:
- the background music
-
toString
-
hashCode
-
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). -
normal
-
underwater
Returns the value of theunderwaterrecord component.- Returns:
- the value of the
underwaterrecord component
-
creative
-