Package net.minecraft.client.gui.widget
Class EntryListWidget<E extends EntryListWidget.Entry<E>>
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.AbstractParentElement
net.minecraft.client.gui.widget.EntryListWidget<E>
- All Implemented Interfaces:
Drawable,Element,ParentElement
- Direct Known Subclasses:
AlwaysSelectedEntryListWidget,ElementListWidget
@Environment(CLIENT) public abstract class EntryListWidget<E extends EntryListWidget.Entry<E>> extends AbstractParentElement implements Drawable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classEntryListWidget.Entriesstatic classEntryListWidget.Entry<E extends EntryListWidget.Entry<E>>static classEntryListWidget.MoveDirectionRepresents the direction in which the selection is moved. -
Field Summary
Fields Modifier and Type Field Description protected intbottomprotected booleancenterListVerticallyprivate List<E>childrenprotected MinecraftClientclientprivate booleanfield_26846private booleanfield_26847protected intheaderHeightprotected intheightprotected intitemHeightprotected intleftprivate booleanrenderHeaderprivate booleanrenderSelectionprotected intrightprivate doublescrollAmountprivate booleanscrollingprivate Eselectedprotected inttopprotected intwidthFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
Constructors Constructor Description EntryListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) -
Method Summary
Modifier and Type Method Description protected intaddEntry(E entry)protected voidcenterScrollOn(E entry)List<E>children()Gets a list of all child GUI elements.protected voidclearEntries()protected voidclickedHeader(int x, int y)protected voidensureVisible(E entry)protected EgetEntry(int index)protected EgetEntryAtPosition(double x, double y)EgetFocused()protected intgetItemCount()protected intgetMaxPosition()intgetMaxScroll()private intgetRowBottom(int index)intgetRowLeft()protected intgetRowTop(int index)intgetRowWidth()doublegetScrollAmount()protected intgetScrollbarPositionX()EgetSelected()protected booleanisFocused()booleanisMouseOver(double mouseX, double mouseY)Checks if the mouse position is within the bound of the element.protected booleanisSelectedItem(int index)booleankeyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured.private voidmethod_29621(EntryListWidget.Entry<E> entry)protected voidmethod_30015()voidmethod_31322(boolean bool)voidmethod_31323(boolean bool)intmethod_31383()booleanmouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured.booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)Callback for when a mouse button drag event has been captured.booleanmouseReleased(double mouseX, double mouseY, int button)Callback for when a mouse button release event has been captured.booleanmouseScrolled(double mouseX, double mouseY, double amount)Callback for when a mouse button scroll event has been captured.protected voidmoveSelection(EntryListWidget.MoveDirection direction)protected voidmoveSelectionIf(EntryListWidget.MoveDirection direction, Predicate<E> predicate)Moves the selection in the specified direction until the predicate returns true.protected Eremove(int index)protected booleanremoveEntry(E entry)voidrender(MatrixStack matrices, int mouseX, int mouseY, float delta)protected voidrenderBackground(MatrixStack matrices)protected voidrenderDecorations(MatrixStack matrixStack, int int2, int int3)protected voidrenderHeader(MatrixStack matrices, int x, int y, Tessellator tessellator)protected voidrenderList(MatrixStack matrices, int x, int y, int mouseX, int mouseY, float delta)protected voidreplaceEntries(Collection<E> newEntries)private voidscroll(int amount)voidsetLeftPos(int left)protected voidsetRenderHeader(boolean renderHeader, int headerHeight)voidsetRenderSelection(boolean renderSelection)voidsetScrollAmount(double amount)voidsetSelected(E entry)protected voidupdateScrollingState(double mouseX, double mouseY, int button)voidupdateSize(int width, int height, int top, int bottom)Methods inherited from class net.minecraft.client.gui.AbstractParentElement
isDragging, setDragging, setFocusedMethods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
mouseMovedMethods inherited from interface net.minecraft.client.gui.ParentElement
changeFocus, charTyped, focusOn, hoveredElement, keyReleased, setInitialFocus
-
Field Details
-
client
-
itemHeight
protected final int itemHeight -
children
-
width
protected int width -
height
protected int height -
top
protected int top -
bottom
protected int bottom -
right
protected int right -
left
protected int left -
centerListVertically
protected boolean centerListVertically -
scrollAmount
private double scrollAmount -
renderSelection
private boolean renderSelection -
renderHeader
private boolean renderHeader -
headerHeight
protected int headerHeight -
scrolling
private boolean scrolling -
selected
-
field_26846
private boolean field_26846 -
field_26847
private boolean field_26847
-
-
Constructor Details
-
EntryListWidget
public EntryListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight)
-
-
Method Details
-
setRenderSelection
public void setRenderSelection(boolean renderSelection) -
setRenderHeader
protected void setRenderHeader(boolean renderHeader, int headerHeight) -
getRowWidth
public int getRowWidth() -
getSelected
-
setSelected
-
method_31322
public void method_31322(boolean bool) -
method_31323
public void method_31323(boolean bool) -
getFocused
- Specified by:
getFocusedin interfaceParentElement- Overrides:
getFocusedin classAbstractParentElement
-
children
Gets a list of all child GUI elements.- Specified by:
childrenin interfaceParentElement
-
clearEntries
protected final void clearEntries() -
replaceEntries
-
getEntry
-
addEntry
-
getItemCount
protected int getItemCount() -
isSelectedItem
protected boolean isSelectedItem(int index) -
getEntryAtPosition
-
updateSize
public void updateSize(int width, int height, int top, int bottom) -
setLeftPos
public void setLeftPos(int left) -
getMaxPosition
protected int getMaxPosition() -
clickedHeader
protected void clickedHeader(int x, int y) -
renderHeader
-
renderBackground
-
renderDecorations
-
render
-
centerScrollOn
-
ensureVisible
-
scroll
private void scroll(int amount) -
getScrollAmount
public double getScrollAmount() -
setScrollAmount
public void setScrollAmount(double amount) -
getMaxScroll
public int getMaxScroll() -
updateScrollingState
protected void updateScrollingState(double mouseX, double mouseY, int button) -
getScrollbarPositionX
protected int getScrollbarPositionX() -
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseClickedin interfaceElement- Specified by:
mouseClickedin interfaceParentElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button)Callback for when a mouse button release event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseReleasedin interfaceElement- Specified by:
mouseReleasedin interfaceParentElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)Callback for when a mouse button drag event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseDraggedin interfaceElement- Specified by:
mouseDraggedin interfaceParentElement- Parameters:
mouseX- the current X coordinate of the mousemouseY- the current Y coordinate of the mousebutton- the mouse button numberdeltaX- the difference of the current X with the previous X coordinatedeltaY- the difference of the current Y with the previous Y coordinate- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onCursorPos(long, double, double),GLFW.GLFW_MOUSE_BUTTON_1
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double amount)Callback for when a mouse button scroll event has been captured.- Specified by:
mouseScrolledin interfaceElement- Specified by:
mouseScrolledin interfaceParentElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mouseamount- value is> 1if scrolled down,< 1if scrolled up- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseScroll(long, double, double)
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
keyPressedin interfaceElement- Specified by:
keyPressedin interfaceParentElement- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- the unique/platform-specific scan code of the keyboard inputmodifiers- a GLFW bitfield describing the modifier keys that are held down (see {@linkplain https://www.glfw.org/docs/3.3/group__mods.html GLFW Modifier key flags})- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Keyboard.onKey(long, int, int, int, int),GLFW.GLFW_KEY_Q,GLFWKeyCallbackI.invoke(long, int, int, int, int)
-
moveSelection
-
method_30015
protected void method_30015() -
moveSelectionIf
Moves the selection in the specified direction until the predicate returns true.- Parameters:
direction- the direction to move the selection
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY)Checks if the mouse position is within the bound of the element.- Specified by:
isMouseOverin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mouse- Returns:
trueif the mouse is within the bound of the element, otherwisefalse
-
renderList
-
getRowLeft
public int getRowLeft() -
method_31383
public int method_31383() -
getRowTop
protected int getRowTop(int index) -
getRowBottom
private int getRowBottom(int index) -
isFocused
protected boolean isFocused() -
remove
-
removeEntry
-
method_29621
-