Class AbstractSelectionList<E extends AbstractSelectionList.Entry<E>>
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractContainerWidget
net.minecraft.client.gui.components.AbstractSelectionList<E>
- All Implemented Interfaces:
ContainerEventHandler,GuiEventListener,Renderable,TabOrderedElement,LayoutElement,NarratableEntry,NarrationSupplier,IAbstractWidgetExtension
- Direct Known Subclasses:
ContainerObjectSelectionList,ObjectSelectionList
public abstract class AbstractSelectionList<E extends AbstractSelectionList.Entry<E>>
extends AbstractContainerWidget
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class(package private) classNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprivate Eprivate static final ResourceLocationprotected final intprivate static final ResourceLocationprotected final Minecraftprivate booleanprivate doubleprotected static final intprivate static final ResourceLocationprivate static final ResourceLocationprivate booleanprivate EFields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSelectionList(Minecraft pMinecraft, int pWidth, int pHeight, int pY, int pItemHeight) -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected voidaddEntryToTop(E pEntry) (package private) voidbindEntryToSelf(AbstractSelectionList.Entry<E> pEntry) protected voidcenterScrollOn(E pEntry) children()voidprotected voidprotected booleanclickedHeader(int pX, int pY) protected voidenableScissor(GuiGraphics pGuiGraphics) protected voidensureVisible(E pEntry) protected intprotected EgetEntry(int pIndex) protected final EgetEntryAtPosition(double pMouseX, double pMouseY) protected Eprotected intprivate intprotected intintprivate intprivate intprotected intgetRowBottom(int pIndex) intintprotected intgetRowTop(int pIndex) intdoubleprotected intbooleanisMouseOver(double pMouseX, double pMouseY) Checks if the given mouse coordinates are over the GUI element.protected booleanisSelectedItem(int pIndex) protected booleanisValidMouseClick(int pButton) booleanmouseClicked(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.booleanmouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.booleanmouseReleased(double pMouseX, double pMouseY, int pButton) Called when a mouse button is released within the GUI element.booleanmouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) protected voidnarrateListElementPosition(NarrationElementOutput pNarrationElementOutput, E pEntry) protected EnextEntry(ScreenDirection pDirection) protected EnextEntry(ScreenDirection pDirection, Predicate<E> pPredicate) protected EnextEntry(ScreenDirection pDirection, Predicate<E> pPredicate, E pSelected) protected Eremove(int pIndex) protected booleanremoveEntry(E pEntry) protected booleanremoveEntryFromTop(E pEntry) protected voidrenderDecorations(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) protected voidrenderHeader(GuiGraphics pGuiGraphics, int pX, int pY) protected voidrenderItem(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick, int pIndex, int pLeft, int pTop, int pWidth, int pHeight) protected voidrenderListBackground(GuiGraphics pGuiGraphics) protected voidrenderListItems(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected voidrenderListSeparators(GuiGraphics pGuiGraphics) protected voidrenderSelection(GuiGraphics pGuiGraphics, int pTop, int pWidth, int pHeight, int pOuterColor, int pInnerColor) voidrenderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected voidreplaceEntries(Collection<E> pEntries) private voidscroll(int pScroll) protected booleanvoidsetClampedScrollAmount(double pScroll) voidsetFocused(GuiEventListener pFocused) Sets the focus state of the GUI element.protected voidsetRenderHeader(boolean pRenderHeader, int pHeaderHeight) voidsetScrollAmount(double pScroll) voidsetSelected(E pSelected) protected voidupdateScrollingState(double pMouseX, double pMouseY, int pButton) voidupdateSize(int pWidth, HeaderAndFooterLayout pLayout) voidupdateSizeAndPosition(int pWidth, int pHeight, int pY) Methods inherited from class net.minecraft.client.gui.components.AbstractContainerWidget
isDragging, isFocused, nextFocusPath, setDragging, setFocusedMethods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, createNarrationMessage, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isHovered, isHoveredOrFocused, isValidClickButton, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, updateWidgetNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, keyPressed, keyReleasedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getRectangle, mouseMovedMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPositionMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
SCROLLBAR_WIDTH
protected static final int SCROLLBAR_WIDTH- See Also:
-
SCROLLER_SPRITE
-
SCROLLER_BACKGROUND_SPRITE
-
MENU_LIST_BACKGROUND
-
INWORLD_MENU_LIST_BACKGROUND
-
minecraft
-
itemHeight
protected final int itemHeight -
children
-
centerListVertically
protected boolean centerListVertically -
scrollAmount
private double scrollAmount -
renderHeader
private boolean renderHeader -
headerHeight
protected int headerHeight -
scrolling
private boolean scrolling -
selected
-
hovered
-
-
Constructor Details
-
AbstractSelectionList
public AbstractSelectionList(Minecraft pMinecraft, int pWidth, int pHeight, int pY, int pItemHeight)
-
-
Method Details
-
setRenderHeader
protected void setRenderHeader(boolean pRenderHeader, int pHeaderHeight) -
getRowWidth
public int getRowWidth() -
getSelected
-
setSelected
-
getFirstElement
-
getFocused
- Specified by:
getFocusedin interfaceContainerEventHandler- Overrides:
getFocusedin classAbstractContainerWidget
-
children
-
clearEntries
protected void clearEntries() -
replaceEntries
-
getEntry
-
addEntry
-
addEntryToTop
-
removeEntryFromTop
-
getItemCount
protected int getItemCount() -
isSelectedItem
protected boolean isSelectedItem(int pIndex) -
getEntryAtPosition
-
updateSizeAndPosition
public void updateSizeAndPosition(int pWidth, int pHeight, int pY) -
getMaxPosition
protected int getMaxPosition() -
clickedHeader
protected boolean clickedHeader(int pX, int pY) -
renderHeader
-
renderDecorations
-
renderWidget
- Specified by:
renderWidgetin classAbstractWidget
-
scrollbarVisible
protected boolean scrollbarVisible() -
renderListSeparators
-
renderListBackground
-
enableScissor
-
centerScrollOn
-
ensureVisible
-
scroll
private void scroll(int pScroll) -
getScrollAmount
public double getScrollAmount() -
setClampedScrollAmount
public void setClampedScrollAmount(double pScroll) -
setScrollAmount
public void setScrollAmount(double pScroll) -
clampScrollAmount
public void clampScrollAmount() -
getMaxScroll
public int getMaxScroll() -
updateScrollingState
protected void updateScrollingState(double pMouseX, double pMouseY, int pButton) -
getScrollbarPosition
protected int getScrollbarPosition() -
getDefaultScrollbarPosition
protected int getDefaultScrollbarPosition() -
getListOutlinePadding
private int getListOutlinePadding() -
isValidMouseClick
protected boolean isValidMouseClick(int pButton) -
mouseClicked
public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) Description copied from class:AbstractWidgetCalled when a mouse button is clicked within the GUI element.- Specified by:
mouseClickedin interfaceContainerEventHandler- Specified by:
mouseClickedin interfaceGuiEventListener- Overrides:
mouseClickedin classAbstractContainerWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that was clicked.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseReleased
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) Description copied from class:AbstractWidgetCalled when a mouse button is released within the GUI element.- Specified by:
mouseReleasedin interfaceContainerEventHandler- Specified by:
mouseReleasedin interfaceGuiEventListener- Overrides:
mouseReleasedin classAbstractContainerWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that was released.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseDragged
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Description copied from class:AbstractWidgetCalled when the mouse is dragged within the GUI element.- Specified by:
mouseDraggedin interfaceContainerEventHandler- Specified by:
mouseDraggedin interfaceGuiEventListener- Overrides:
mouseDraggedin classAbstractContainerWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that is being dragged.pDragX- the X distance of the drag.pDragY- the Y distance of the drag.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseScrolled
public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) -
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Overrides:
setFocusedin classAbstractContainerWidget- Parameters:
pFocused- the focused GUI element.
-
isMouseOver
public boolean isMouseOver(double pMouseX, double pMouseY) Description copied from class:AbstractWidgetChecks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOverin interfaceGuiEventListener- Overrides:
isMouseOverin classAbstractWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.- Returns:
trueif the mouse is over the GUI element,falseotherwise.
-
renderListItems
protected void renderListItems(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) -
renderItem
protected void renderItem(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick, int pIndex, int pLeft, int pTop, int pWidth, int pHeight) -
renderSelection
protected void renderSelection(GuiGraphics pGuiGraphics, int pTop, int pWidth, int pHeight, int pOuterColor, int pInnerColor) -
getRowLeft
public int getRowLeft() -
getRealRowLeft
private int getRealRowLeft() -
getRowRight
public int getRowRight() -
getRealRowRight
private int getRealRowRight() -
getRowTop
protected int getRowTop(int pIndex) -
getRowBottom
protected int getRowBottom(int pIndex) -
narrationPriority
- Specified by:
narrationPriorityin interfaceNarratableEntry- Overrides:
narrationPriorityin classAbstractWidget
-
remove
-
removeEntry
-
getHovered
-
bindEntryToSelf
-
narrateListElementPosition
-