Record Class JukeboxPlayable
java.lang.Object
java.lang.Record
net.minecraft.world.item.JukeboxPlayable
- All Implemented Interfaces:
TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<JukeboxPlayable> private final Holder<JukeboxSong> The field for thesongrecord component.static final StreamCodec<RegistryFriendlyByteBuf, JukeboxPlayable> -
Constructor Summary
ConstructorsConstructorDescriptionJukeboxPlayable(Holder<JukeboxSong> song) Creates an instance of aJukeboxPlayablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.song()Returns the value of thesongrecord component.final StringtoString()Returns a string representation of this record class.static InteractionResulttryInsertIntoJukebox(Level level, BlockPos pos, ItemStack toInsert, Player player)
-
Field Details
-
song
The field for thesongrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
JukeboxPlayable
Creates an instance of aJukeboxPlayablerecord class.- Parameters:
song- the value for thesongrecord component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) - Specified by:
addToTooltipin interfaceTooltipProvider
-
tryInsertIntoJukebox
public static InteractionResult tryInsertIntoJukebox(Level level, BlockPos pos, ItemStack toInsert, Player player) -
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). -
song
Returns the value of thesongrecord component.- Returns:
- the value of the
songrecord component
-