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) class
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
private E
private static final ResourceLocation
protected final int
private static final ResourceLocation
protected final Minecraft
private boolean
private double
protected static final int
private static final ResourceLocation
private static final ResourceLocation
private boolean
private E
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, width
Fields 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 int
protected void
addEntryToTop
(E entry) (package private) void
protected void
centerScrollOn
(E entry) children()
void
protected void
protected boolean
clickedHeader
(int x, int y) protected void
enableScissor
(GuiGraphics guiGraphics) protected void
ensureVisible
(E entry) protected int
protected E
getEntry
(int index) protected final E
getEntryAtPosition
(double mouseX, double mouseY) protected E
protected int
private int
protected int
int
private int
private int
protected int
getRowBottom
(int index) int
int
protected int
getRowTop
(int index) int
double
protected int
boolean
isMouseOver
(double mouseX, double mouseY) Checks if the given mouse coordinates are over the GUI element.protected boolean
isSelectedItem
(int index) protected boolean
isValidMouseClick
(int button) boolean
mouseClicked
(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged within the GUI element.boolean
mouseReleased
(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.boolean
mouseScrolled
(double mouseX, double mouseY, double scrollX, double scrollY) protected void
narrateListElementPosition
(NarrationElementOutput narrationElementOutput, E entry) protected E
nextEntry
(ScreenDirection direction) protected E
nextEntry
(ScreenDirection direction, Predicate<E> predicate) protected E
nextEntry
(ScreenDirection direction, Predicate<E> predicate, E selected) protected E
remove
(int index) protected boolean
removeEntry
(E entry) protected boolean
removeEntryFromTop
(E entry) protected void
renderDecorations
(GuiGraphics guiGraphics, int mouseX, int mouseY) protected void
renderHeader
(GuiGraphics guiGraphics, int x, int y) protected void
renderItem
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, int index, int left, int top, int width, int height) protected void
renderListBackground
(GuiGraphics guiGraphics) protected void
renderListItems
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected void
renderListSeparators
(GuiGraphics guiGraphics) protected void
renderSelection
(GuiGraphics guiGraphics, int top, int width, int height, int outerColor, int innerColor) void
renderWidget
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected void
replaceEntries
(Collection<E> entries) private void
scroll
(int scroll) protected boolean
void
setClampedScrollAmount
(double scroll) void
setFocused
(GuiEventListener focused) Sets the focus state of the GUI element.protected void
setRenderHeader
(boolean renderHeader, int headerHeight) void
setScrollAmount
(double scroll) void
setSelected
(E selected) protected void
updateScrollingState
(double mouseX, double mouseY, int button) void
updateSize
(int width, HeaderAndFooterLayout layout) void
updateSizeAndPosition
(int width, int height, int y) Methods inherited from class net.minecraft.client.gui.components.AbstractContainerWidget
isDragging, isFocused, nextFocusPath, setDragging, setFocused
Methods 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, wrapDefaultNarrationMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, keyPressed, keyReleased
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getRectangle, mouseMoved
Methods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClick
Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
Methods 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:
getFocused
in interfaceContainerEventHandler
- Overrides:
getFocused
in 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:
renderWidget
in 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:AbstractWidget
Called when a mouse button is clicked within the GUI element.- Specified by:
mouseClicked
in interfaceContainerEventHandler
- Specified by:
mouseClicked
in interfaceGuiEventListener
- Overrides:
mouseClicked
in classAbstractContainerWidget
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Description copied from class:AbstractWidget
Called when a mouse button is released within the GUI element.- Specified by:
mouseReleased
in interfaceContainerEventHandler
- Specified by:
mouseReleased
in interfaceGuiEventListener
- Overrides:
mouseReleased
in classAbstractContainerWidget
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Description copied from class:AbstractWidget
Called when the mouse is dragged within the GUI element.- Specified by:
mouseDragged
in interfaceContainerEventHandler
- Specified by:
mouseDragged
in interfaceGuiEventListener
- Overrides:
mouseDragged
in 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:
true
if the event is consumed,false
otherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) -
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocused
in interfaceContainerEventHandler
- Overrides:
setFocused
in classAbstractContainerWidget
- Parameters:
focused
- the focused GUI element.
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Description copied from class:AbstractWidget
Checks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOver
in interfaceGuiEventListener
- Overrides:
isMouseOver
in classAbstractWidget
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.- Returns:
true
if the mouse is over the GUI element,false
otherwise.
-
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:
narrationPriority
in interfaceNarratableEntry
- Overrides:
narrationPriority
in classAbstractWidget
-
remove
-
removeEntry
-
getHovered
-
bindEntryToSelf
-
narrateListElementPosition
-