Record Class ItemLore
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.ItemLore
- All Implemented Interfaces:
TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemLore> static final ItemLoreThe field for thelinesrecord component.private static final Stylestatic final intstatic final StreamCodec<RegistryFriendlyByteBuf, ItemLore> The field for thestyledLinesrecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext p_329761_, Consumer<Component> p_332607_, TooltipFlag p_328590_) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.lines()Returns the value of thelinesrecord component.Returns the value of thestyledLinesrecord component.final StringtoString()Returns a string representation of this record class.withLineAdded(Component p_328621_)
-
Field Details
-
lines
The field for thelinesrecord component. -
styledLines
The field for thestyledLinesrecord 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 aItemLorerecord class.- Parameters:
lines- the value for thelinesrecord componentstyledLines- the value for thestyledLinesrecord component
-
-
Method Details
-
withLineAdded
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_329761_, Consumer<Component> p_332607_, TooltipFlag p_328590_) - Specified by:
addToTooltipin 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 thelinesrecord component.- Returns:
- the value of the
linesrecord component
-
styledLines
Returns the value of thestyledLinesrecord component.- Returns:
- the value of the
styledLinesrecord component
-