Package net.minecraft.world.item
Record Class JukeboxPlayable
java.lang.Object
java.lang.Record
net.minecraft.world.item.JukeboxPlayable
- All Implemented Interfaces:
TooltipProvider
public record JukeboxPlayable(EitherHolder<JukeboxSong> song)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<JukeboxPlayable> private final EitherHolder
<JukeboxSong> The field for thesong
record component.static final StreamCodec
<RegistryFriendlyByteBuf, JukeboxPlayable> -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aJukeboxPlayable
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToTooltip
(Item.TooltipContext p_350489_, Consumer<Component> p_350818_, TooltipFlag p_350358_, DataComponentGetter p_399685_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.song()
Returns the value of thesong
record component.final String
toString()
Returns a string representation of this record class.static InteractionResult
tryInsertIntoJukebox
(Level p_350560_, BlockPos p_350567_, ItemStack p_350531_, Player p_350807_)
-
Field Details
-
song
The field for thesong
record component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
JukeboxPlayable
Creates an instance of aJukeboxPlayable
record class.- Parameters:
song
- the value for thesong
record component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_350489_, Consumer<Component> p_350818_, TooltipFlag p_350358_, DataComponentGetter p_399685_) - Specified by:
addToTooltip
in interfaceTooltipProvider
-
tryInsertIntoJukebox
public static InteractionResult tryInsertIntoJukebox(Level p_350560_, BlockPos p_350567_, ItemStack p_350531_, Player p_350807_) -
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)
. -
song
Returns the value of thesong
record component.- Returns:
- the value of the
song
record component
-