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 minecraft, int width, int height, int y, int itemHeight) -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected voidaddEntryToTop(E entry) (package private) voidprotected voidcenterScrollOn(E entry) children()voidprotected voidprotected booleanclickedHeader(int x, int y) protected voidenableScissor(GuiGraphics guiGraphics) protected voidensureVisible(E entry) protected intprotected EgetEntry(int index) protected final EgetEntryAtPosition(double mouseX, double mouseY) protected Eprotected intprivate intprotected intintprivate intprivate intprotected intgetRowBottom(int index) intintprotected intgetRowTop(int index) intdoubleprotected intbooleanisMouseOver(double mouseX, double mouseY) Checks if the given mouse coordinates are over the GUI element.protected booleanisSelectedItem(int index) protected booleanisValidMouseClick(int button) booleanmouseClicked(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged within the GUI element.booleanmouseReleased(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidnarrateListElementPosition(NarrationElementOutput narrationElementOutput, E entry) protected EnextEntry(ScreenDirection direction) protected EnextEntry(ScreenDirection direction, Predicate<E> predicate) protected EnextEntry(ScreenDirection direction, Predicate<E> predicate, E selected) protected Eremove(int index) protected booleanremoveEntry(E entry) protected booleanremoveEntryFromTop(E entry) protected voidrenderDecorations(GuiGraphics guiGraphics, int mouseX, int mouseY) protected voidrenderHeader(GuiGraphics guiGraphics, int x, int y) protected voidrenderItem(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, int index, int left, int top, int width, int height) protected voidrenderListBackground(GuiGraphics guiGraphics) protected voidrenderListItems(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected voidrenderListSeparators(GuiGraphics guiGraphics) protected voidrenderSelection(GuiGraphics guiGraphics, int top, int width, int height, int outerColor, int innerColor) voidrenderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected voidreplaceEntries(Collection<E> entries) private voidscroll(int scroll) protected booleanvoidsetClampedScrollAmount(double scroll) voidsetFocused(GuiEventListener focused) Sets the focus state of the GUI element.protected voidsetRenderHeader(boolean renderHeader, int headerHeight) voidsetScrollAmount(double scroll) voidsetSelected(E selected) protected voidupdateScrollingState(double mouseX, double mouseY, int button) voidupdateSize(int width, HeaderAndFooterLayout layout) voidupdateSizeAndPosition(int width, int height, int y) 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
-
-
Method Details
-
setRenderHeader
protected void setRenderHeader(boolean renderHeader, int headerHeight) -
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 index) -
getEntryAtPosition
-
updateSizeAndPosition
public void updateSizeAndPosition(int width, int height, int y) -
getMaxPosition
protected int getMaxPosition() -
clickedHeader
protected boolean clickedHeader(int x, int y) -
renderHeader
-
renderDecorations
-
renderWidget
- Specified by:
renderWidgetin classAbstractWidget
-
scrollbarVisible
protected boolean scrollbarVisible() -
renderListSeparators
-
renderListBackground
-
enableScissor
-
centerScrollOn
-
ensureVisible
-
scroll
private void scroll(int scroll) -
getScrollAmount
public double getScrollAmount() -
setClampedScrollAmount
public void setClampedScrollAmount(double scroll) -
setScrollAmount
public void setScrollAmount(double scroll) -
clampScrollAmount
public void clampScrollAmount() -
getMaxScroll
public int getMaxScroll() -
updateScrollingState
protected void updateScrollingState(double mouseX, double mouseY, int button) -
getScrollbarPosition
protected int getScrollbarPosition() -
getDefaultScrollbarPosition
protected int getDefaultScrollbarPosition() -
getListOutlinePadding
private int getListOutlinePadding() -
isValidMouseClick
protected boolean isValidMouseClick(int button) -
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) 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:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that was clicked.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) 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:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that was released.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) 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:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that is being dragged.dragX- the X distance of the drag.dragY- the Y distance of the drag.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) -
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Overrides:
setFocusedin classAbstractContainerWidget- Parameters:
focused- the focused GUI element.
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Description copied from class:AbstractWidgetChecks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOverin interfaceGuiEventListener- Overrides:
isMouseOverin classAbstractWidget- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.- Returns:
trueif the mouse is over the GUI element,falseotherwise.
-
renderListItems
-
renderItem
protected void renderItem(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, int index, int left, int top, int width, int height) -
renderSelection
protected void renderSelection(GuiGraphics guiGraphics, int top, int width, int height, int outerColor, int innerColor) -
getRowLeft
public int getRowLeft() -
getRealRowLeft
private int getRealRowLeft() -
getRowRight
public int getRowRight() -
getRealRowRight
private int getRealRowRight() -
getRowTop
protected int getRowTop(int index) -
getRowBottom
protected int getRowBottom(int index) -
narrationPriority
- Specified by:
narrationPriorityin interfaceNarratableEntry- Overrides:
narrationPriorityin classAbstractWidget
-
remove
-
removeEntry
-
getHovered
-
bindEntryToSelf
-
narrateListElementPosition
-