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, boolean showInTooltip)
extends Record
implements TooltipProvider
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<JukeboxPlayable> private final boolean
The field for theshowInTooltip
record component.private final EitherHolder
<JukeboxSong> The field for thesong
record component.static final StreamCodec
<RegistryFriendlyByteBuf, JukeboxPlayable> -
Constructor Summary
ConstructorDescriptionJukeboxPlayable
(EitherHolder<JukeboxSong> song, boolean showInTooltip) Creates an instance of aJukeboxPlayable
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToTooltip
(Item.TooltipContext p_343529_, Consumer<Component> p_344027_, TooltipFlag p_344530_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theshowInTooltip
record component.song()
Returns the value of thesong
record component.final String
toString()
Returns a string representation of this record class.static ItemInteractionResult
tryInsertIntoJukebox
(Level p_342790_, BlockPos p_344904_, ItemStack p_345065_, Player p_342036_) withTooltip
(boolean p_343241_)
-
Field Details
-
song
The field for thesong
record component. -
showInTooltip
private final boolean showInTooltipThe field for theshowInTooltip
record component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
JukeboxPlayable
Creates an instance of aJukeboxPlayable
record class.- Parameters:
song
- the value for thesong
record componentshowInTooltip
- the value for theshowInTooltip
record component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_343529_, Consumer<Component> p_344027_, TooltipFlag p_344530_) - Specified by:
addToTooltip
in interfaceTooltipProvider
-
withTooltip
-
tryInsertIntoJukebox
public static ItemInteractionResult tryInsertIntoJukebox(Level p_342790_, BlockPos p_344904_, ItemStack p_345065_, Player p_342036_) -
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 '=='. -
song
Returns the value of thesong
record component.- Returns:
- the value of the
song
record component
-
showInTooltip
public boolean showInTooltip()Returns the value of theshowInTooltip
record component.- Returns:
- the value of the
showInTooltip
record component
-