Package net.minecraft.world.item
Record Class JukeboxSong
java.lang.Object
java.lang.Record
net.minecraft.world.item.JukeboxSong
public record JukeboxSong(Holder<SoundEvent> soundEvent, Component description, float lengthInSeconds, int comparatorOutput)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Holder<JukeboxSong>> private final intThe field for thecomparatorOutputrecord component.private final ComponentThe field for thedescriptionrecord component.static final com.mojang.serialization.Codec<JukeboxSong> static final StreamCodec<RegistryFriendlyByteBuf, JukeboxSong> private final floatThe field for thelengthInSecondsrecord component.private static final intprivate final Holder<SoundEvent> The field for thesoundEventrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Holder<JukeboxSong>> -
Constructor Summary
ConstructorsConstructorDescriptionJukeboxSong(Holder<SoundEvent> soundEvent, Component description, float lengthInSeconds, int comparatorOutput) Creates an instance of aJukeboxSongrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecomparatorOutputrecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.static Optional<Holder<JukeboxSong>> fromStack(HolderLookup.Provider p_350602_, ItemStack p_350870_) booleanhasFinished(long p_350621_) final inthashCode()Returns a hash code value for this object.floatReturns the value of thelengthInSecondsrecord component.intReturns the value of thesoundEventrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
soundEvent
The field for thesoundEventrecord component. -
description
The field for thedescriptionrecord component. -
lengthInSeconds
private final float lengthInSecondsThe field for thelengthInSecondsrecord component. -
comparatorOutput
private final int comparatorOutputThe field for thecomparatorOutputrecord component. -
DIRECT_CODEC
-
DIRECT_STREAM_CODEC
-
CODEC
-
STREAM_CODEC
-
SONG_END_PADDING_TICKS
private static final int SONG_END_PADDING_TICKS- See Also:
-
-
Constructor Details
-
JukeboxSong
public JukeboxSong(Holder<SoundEvent> soundEvent, Component description, float lengthInSeconds, int comparatorOutput) Creates an instance of aJukeboxSongrecord class.- Parameters:
soundEvent- the value for thesoundEventrecord componentdescription- the value for thedescriptionrecord componentlengthInSeconds- the value for thelengthInSecondsrecord componentcomparatorOutput- the value for thecomparatorOutputrecord component
-
-
Method Details
-
lengthInTicks
public int lengthInTicks() -
hasFinished
public boolean hasFinished(long p_350621_) -
fromStack
public static Optional<Holder<JukeboxSong>> fromStack(HolderLookup.Provider p_350602_, ItemStack p_350870_) -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
soundEvent
Returns the value of thesoundEventrecord component.- Returns:
- the value of the
soundEventrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
lengthInSeconds
public float lengthInSeconds()Returns the value of thelengthInSecondsrecord component.- Returns:
- the value of the
lengthInSecondsrecord component
-
comparatorOutput
public int comparatorOutput()Returns the value of thecomparatorOutputrecord component.- Returns:
- the value of the
comparatorOutputrecord component
-