Class AbstractSelectionList<E extends AbstractSelectionList.Entry<E>>

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier
Direct Known Subclasses:
ContainerObjectSelectionList, ObjectSelectionList

public abstract class AbstractSelectionList<E extends AbstractSelectionList.Entry<E>> extends AbstractContainerWidget
  • Field Details

  • Constructor Details

    • AbstractSelectionList

      public AbstractSelectionList(Minecraft minecraft, int width, int height, int y, int itemHeight)
  • Method Details

    • getSelected

      @Nullable public E getSelected()
    • setSelected

      public void setSelected(@Nullable E selected)
    • getFocused

      @Nullable public E getFocused()
      Specified by:
      getFocused in interface ContainerEventHandler
      Overrides:
      getFocused in class AbstractContainerWidget
    • children

      public final List<E> children()
    • sort

      protected void sort(Comparator<E> comparator)
    • swap

      protected void swap(int index1, int index2)
    • clearEntries

      public void clearEntries()
    • clearEntriesExcept

      protected void clearEntriesExcept(E entry)
    • replaceEntries

      public void replaceEntries(Collection<E> entries)
    • getFirstEntryY

      private int getFirstEntryY()
    • getNextY

      public int getNextY()
    • addEntry

      protected int addEntry(E entry)
    • addEntry

      protected int addEntry(E entry, int index)
    • addEntryToTop

      protected void addEntryToTop(E entry)
    • addEntryToTop

      protected void addEntryToTop(E entry, int height)
    • repositionEntries

      private void repositionEntries()
    • removeEntryFromTop

      protected void removeEntryFromTop(E entry)
    • getItemCount

      protected int getItemCount()
    • entriesCanBeSelected

      protected boolean entriesCanBeSelected()
    • getEntryAtPosition

      @Nullable protected final E getEntryAtPosition(double mouseX, double mouseY)
    • updateSize

      public void updateSize(int width, HeaderAndFooterLayout layout)
    • updateSizeAndPosition

      public void updateSizeAndPosition(int width, int height, int y)
    • updateSizeAndPosition

      public void updateSizeAndPosition(int width, int height, int x, int y)
    • contentHeight

      protected int contentHeight()
      Specified by:
      contentHeight in class AbstractScrollArea
    • renderWidget

      public void renderWidget(GuiGraphics p_282708_, int p_283242_, int p_282891_, float p_283683_)
      Specified by:
      renderWidget in class AbstractWidget
    • renderListSeparators

      protected void renderListSeparators(GuiGraphics guiGraphics)
    • renderListBackground

      protected void renderListBackground(GuiGraphics guiGraphics)
    • enableScissor

      protected void enableScissor(GuiGraphics guiGraphics)
    • scrollToEntry

      protected void scrollToEntry(E entry)
    • centerScrollOn

      protected void centerScrollOn(E entry)
    • scroll

      private void scroll(int scroll)
    • setScrollAmount

      public void setScrollAmount(double p_439419_)
      Overrides:
      setScrollAmount in class AbstractScrollArea
    • scrollRate

      protected double scrollRate()
      Specified by:
      scrollRate in class AbstractScrollArea
    • scrollBarX

      protected int scrollBarX()
      Overrides:
      scrollBarX in class AbstractScrollArea
    • getChildAt

      public Optional<GuiEventListener> getChildAt(double p_386910_, double p_387686_)
      Description copied from interface: ContainerEventHandler
      Returns the first event listener that intersects with the mouse coordinates.
    • setFocused

      public void setFocused(boolean p_439058_)
      Description copied from interface: GuiEventListener
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface ContainerEventHandler
      Specified by:
      setFocused in interface GuiEventListener
      Overrides:
      setFocused in class AbstractContainerWidget
      Parameters:
      p_439058_ - true to apply focus, false to remove focus
    • setFocused

      public void setFocused(@Nullable GuiEventListener p_265738_)
      Description copied from interface: ContainerEventHandler
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface ContainerEventHandler
      Overrides:
      setFocused in class AbstractContainerWidget
      Parameters:
      p_265738_ - the focused GUI element.
    • nextEntry

      @Nullable protected E nextEntry(ScreenDirection direction)
    • nextEntry

      @Nullable protected E nextEntry(ScreenDirection direction, Predicate<E> predicate)
    • nextEntry

      @Nullable protected E nextEntry(ScreenDirection direction, Predicate<E> predicate, @Nullable E selected)
    • renderListItems

      protected void renderListItems(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
    • renderItem

      protected void renderItem(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, E item)
    • renderSelection

      protected void renderSelection(GuiGraphics guiGraphics, E entry, int backgroundColor)
    • getRowLeft

      public int getRowLeft()
    • getRowRight

      public int getRowRight()
    • getRowTop

      public int getRowTop(int index)
    • getRowBottom

      public int getRowBottom(int index)
    • getRowWidth

      public int getRowWidth()
    • narrationPriority

      public NarratableEntry.NarrationPriority narrationPriority()
      Specified by:
      narrationPriority in interface NarratableEntry
      Overrides:
      narrationPriority in class AbstractWidget
    • removeEntries

      protected void removeEntries(List<E> entries)
    • removeEntry

      protected void removeEntry(E entry)
    • getHovered

      @Nullable protected E getHovered()
    • bindEntryToSelf

      void bindEntryToSelf(AbstractSelectionList.Entry<E> entry)
    • narrateListElementPosition

      protected void narrateListElementPosition(NarrationElementOutput narrationElementOutput, E entry)