Record Class ItemLore
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.ItemLore
- All Implemented Interfaces:
TooltipProvider
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<ItemLore> static final ItemLore
The field for thelines
record component.private static final Style
static final int
static final StreamCodec
<RegistryFriendlyByteBuf, ItemLore> The field for thestyledLines
record component. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToTooltip
(Item.TooltipContext p_341353_, Consumer<Component> p_332116_, TooltipFlag p_330800_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.lines()
Returns the value of thelines
record component.Returns the value of thestyledLines
record component.final String
toString()
Returns a string representation of this record class.withLineAdded
(Component p_330547_)
-
Field Details
-
lines
The field for thelines
record component. -
styledLines
The field for thestyledLines
record component. -
EMPTY
-
MAX_LINES
public static final int MAX_LINES- See Also:
-
LORE_STYLE
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
ItemLore
-
ItemLore
Creates an instance of aItemLore
record class.- Parameters:
lines
- the value for thelines
record componentstyledLines
- the value for thestyledLines
record component
-
-
Method Details
-
withLineAdded
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_341353_, Consumer<Component> p_332116_, TooltipFlag p_330800_) - Specified by:
addToTooltip
in interfaceTooltipProvider
-
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)
. -
lines
Returns the value of thelines
record component.- Returns:
- the value of the
lines
record component
-
styledLines
Returns the value of thestyledLines
record component.- Returns:
- the value of the
styledLines
record component
-