Record Class SlotSection

java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.SlotSection
Record Components:
id - this section's id within its menu
type - the registered type handle this section was decoded as
col - the slot's column
row - the slot's row
item - fixed appearance, or null when this is a multi-state slot
states - appearance per state name, or null for a fixed slot
defaultState - which of states to show first, or null for a fixed slot
soundOnClick - played when the slot is clicked
hideAtBoundary - whether a page button hides itself at the first or last page
All Implemented Interfaces:
Section

public record SlotSection(String id, SectionType<SlotSection> type, int col, int row, @Nullable ItemAppearance item, @Nullable Map<String,ItemAppearance> states, @Nullable String defaultState, SoundSpec soundOnClick, boolean hideAtBoundary) extends Record implements Section
Single-slot section. Either a fixed appearance (item non-null) or a multi-state slot (states non-null with defaultState naming a key from the map). Exactly one of the two must be set.

hideAtBoundary only matters when this slot is referenced by a PaginatedListSection as previous-page-section or next-page-section: when true (default), the button is not rendered if the list is on the first/last page (no previous/next page to go to). When false, the button is always rendered (clicking it at the boundary is a silent no-op).

  • Constructor Details

  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • id

      public String id()
      Returns the value of the id record component.
      Specified by:
      id in interface Section
      Returns:
      the value of the id record component
    • type

      public SectionType<SlotSection> type()
      Returns the value of the type record component.
      Specified by:
      type in interface Section
      Returns:
      the value of the type record component
    • col

      public int col()
      Returns the value of the col record component.
      Returns:
      the value of the col record component
    • row

      public int row()
      Returns the value of the row record component.
      Returns:
      the value of the row record component
    • item

      @Nullable public @Nullable ItemAppearance item()
      Returns the value of the item record component.
      Returns:
      the value of the item record component
    • states

      @Nullable public @Nullable Map<String,ItemAppearance> states()
      Returns the value of the states record component.
      Returns:
      the value of the states record component
    • defaultState

      @Nullable public @Nullable String defaultState()
      Returns the value of the defaultState record component.
      Returns:
      the value of the defaultState record component
    • soundOnClick

      public SoundSpec soundOnClick()
      Returns the value of the soundOnClick record component.
      Returns:
      the value of the soundOnClick record component
    • hideAtBoundary

      public boolean hideAtBoundary()
      Returns the value of the hideAtBoundary record component.
      Returns:
      the value of the hideAtBoundary record component