Record Class ItemLore

java.lang.Object
java.lang.Record
fr.fidorial.item.component.ItemLore
Record Components:
lines - the lines, in the order they are drawn

public record ItemLore(List<Component> lines) extends Record
The extra tooltip lines a stack carries, under minecraft:lore.
Since:
0.1.0
  • Field Details

    • MAX_LINES

      public static final int MAX_LINES
      The most lines the client accepts.
      See Also:
    • EMPTY

      public static final ItemLore EMPTY
      No lore at all.
  • Constructor Details

    • ItemLore

      public ItemLore(List<Component> lines)
      Creates an instance of a ItemLore record class.
      Parameters:
      lines - the value for the lines record component
  • Method Details

    • of

      public static ItemLore of(Component... lines)
      Parameters:
      lines - the lines, in the order they are drawn
      Returns:
      a lore of those lines
    • of

      public static ItemLore of(List<Component> lines)
      Parameters:
      lines - the lines, in the order they are drawn
      Returns:
      a lore of those lines
    • plus

      public ItemLore plus(Component line)
      Parameters:
      line - the line to append
      Returns:
      a new lore, one line longer
    • isEmpty

      public boolean isEmpty()
      Returns:
      true when there is nothing to draw
    • size

      public int size()
      Returns:
      how many lines this lore holds
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • lines

      public List<Component> lines()
      Returns the value of the lines record component.
      Returns:
      the value of the lines record component