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 pMinecraft, int pWidth, int pHeight, int pY, int pItemHeight) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
protected void
addEntryToTop
(E pEntry) (package private) void
bindEntryToSelf
(AbstractSelectionList.Entry<E> pEntry) protected void
centerScrollOn
(E pEntry) children()
void
protected void
protected boolean
clickedHeader
(int pX, int pY) protected void
enableScissor
(GuiGraphics pGuiGraphics) protected void
ensureVisible
(E pEntry) protected int
protected E
getEntry
(int pIndex) protected final E
getEntryAtPosition
(double pMouseX, double pMouseY) protected E
protected int
private int
protected int
int
private int
private int
protected int
getRowBottom
(int pIndex) int
int
protected int
getRowTop
(int pIndex) int
double
protected int
boolean
isMouseOver
(double pMouseX, double pMouseY) Checks if the given mouse coordinates are over the GUI element.protected boolean
isSelectedItem
(int pIndex) protected boolean
isValidMouseClick
(int pButton) boolean
mouseClicked
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.boolean
mouseReleased
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is released within the GUI element.boolean
mouseScrolled
(double pMouseX, double pMouseY, double pScrollX, double pScrollY) protected void
narrateListElementPosition
(NarrationElementOutput pNarrationElementOutput, E pEntry) protected E
nextEntry
(ScreenDirection pDirection) protected E
nextEntry
(ScreenDirection pDirection, Predicate<E> pPredicate) protected E
nextEntry
(ScreenDirection pDirection, Predicate<E> pPredicate, E pSelected) protected E
remove
(int pIndex) protected boolean
removeEntry
(E pEntry) protected boolean
removeEntryFromTop
(E pEntry) protected void
renderDecorations
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) protected void
renderHeader
(GuiGraphics pGuiGraphics, int pX, int pY) protected void
renderItem
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick, int pIndex, int pLeft, int pTop, int pWidth, int pHeight) protected void
renderListBackground
(GuiGraphics pGuiGraphics) protected void
renderListItems
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected void
renderListSeparators
(GuiGraphics pGuiGraphics) protected void
renderSelection
(GuiGraphics pGuiGraphics, int pTop, int pWidth, int pHeight, int pOuterColor, int pInnerColor) void
renderWidget
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected void
replaceEntries
(Collection<E> pEntries) private void
scroll
(int pScroll) protected boolean
void
setClampedScrollAmount
(double pScroll) void
setFocused
(GuiEventListener pFocused) Sets the focus state of the GUI element.protected void
setRenderHeader
(boolean pRenderHeader, int pHeaderHeight) void
setScrollAmount
(double pScroll) void
setSelected
(E pSelected) protected void
updateScrollingState
(double pMouseX, double pMouseY, int pButton) void
updateSize
(int pWidth, HeaderAndFooterLayout pLayout) void
updateSizeAndPosition
(int pWidth, int pHeight, int pY) 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
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:
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 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:
renderWidget
in 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: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:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) 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:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseDragged
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) 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:
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:
true
if the event is consumed,false
otherwise.
-
mouseScrolled
public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) -
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocused
in interfaceContainerEventHandler
- Overrides:
setFocused
in classAbstractContainerWidget
- Parameters:
pFocused
- the focused GUI element.
-
isMouseOver
public boolean isMouseOver(double pMouseX, double pMouseY) 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:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.- Returns:
true
if the mouse is over the GUI element,false
otherwise.
-
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:
narrationPriority
in interfaceNarratableEntry
- Overrides:
narrationPriority
in classAbstractWidget
-
remove
-
removeEntry
-
getHovered
-
bindEntryToSelf
-
narrateListElementPosition
-