Scrollable UI
dev.anvilcraft.lib.v2.util.Scrollable is an abstract class for implementing scrollable UI lists.
Core methods:
calculateRowCount()– calculates the number of scrollable rows based onsize()/column()getRowIndex()– the row index corresponding to the current scroll positionscrollOnDrag(barHeight, mouseY, top, bottom)– updates the position when dragging the scroll barscrollOnScroll(scrollY)– mouse wheel inputreset()– scrolls back to the topcanScroll()– whether there is enough content to require scrolling
Abstract methods that must be implemented:
row()– number of visible rowscolumn()– number of columns per rowsize()– total number of elementssetHead(int head)– sets the starting index of the currently visible items (updates list data based on scroll position)