Class ScrollableListWidget<T extends net.minecraft.client.gui.layouts.LayoutElement & net.minecraft.client.gui.components.Renderable>
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractScrollWidget
com.pixelmonmod.pixelmon.client.gui.npc.widget.ScrollableListWidget<T>
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener
,net.minecraft.client.gui.components.Renderable
,net.minecraft.client.gui.components.TabOrderedElement
,net.minecraft.client.gui.layouts.LayoutElement
,net.minecraft.client.gui.narration.NarratableEntry
,net.minecraft.client.gui.narration.NarrationSupplier
public class ScrollableListWidget<T extends net.minecraft.client.gui.layouts.LayoutElement & net.minecraft.client.gui.components.Renderable>
extends net.minecraft.client.gui.components.AbstractScrollWidget
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
-
Field Summary
Fields inherited from class net.minecraft.client.gui.components.AbstractScrollWidget
scrollAmount, scrolling
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, focused, height, hoverOrFocusedStartTime, isHovered, message, MIN_SCROLL_PERIOD, packedFGColor, PERIOD_PER_SCROLLED_PIXEL, tabOrderGroup, tooltip, tooltipMsDelay, UNSET_FG_COLOR, visible, wasHoveredOrFocused, width, x, y
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorDescriptionScrollableListWidget
(int width, int height) ScrollableListWidget
(int x, int y, int width, int height) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWidgets
(T... widgets) boolean
charTyped
(char character, int modifiers) protected T
findElementFor
(double mouseX, double mouseY) protected double
double
getElementY
(T element) Gets the y position of a widget relative to the scrollable list widget.protected int
int
getInnerHeightOfLayoutElementWidget
(net.minecraft.client.gui.layouts.LayoutElement widgetToGetHeightFor) double
getMouseYTranslatedToWidgetY
(double mouseY) Gets the y position of the cursor relative to the scrollable list widget.boolean
keyPressed
(int keyCode, int scanCode, int modifiers) boolean
mouseClicked
(double mouseX, double mouseY, int button) boolean
mouseDragged
(double mouseX, double mouseY, int button, double deltaX, double deltaY) boolean
mouseScrolled
(double mouseX, double mouseY, double deltaX, double deltaY) protected void
renderBackground
(net.minecraft.client.gui.GuiGraphics p_282207_) protected void
renderContents
(net.minecraft.client.gui.GuiGraphics gui, int mouseX, int mouseY, float partialTicks) protected double
void
scrollWidgetUponMouseClicked
(T element) Scrolls the scrollbar upon a widget being clicked.protected void
setFocussed
(T focussed) void
setPaddingY
(int paddingY) protected void
updateWidgetNarration
(net.minecraft.client.gui.narration.NarrationElementOutput p_259858_) Methods inherited from class net.minecraft.client.gui.components.AbstractScrollWidget
getMaxScrollAmount, innerPadding, mouseReleased, renderBorder, renderDecorations, renderWidget, scrollAmount, scrollbarVisible, scrollbarWidth, setScrollAmount, totalInnerPadding, withinContentAreaPoint, withinContentAreaTopBottom
Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, createNarrationMessage, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getRectangle, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, narrationPriority, nextFocusPath, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setFocused, setHeight, setMessage, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, 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.GuiEventListener
getCurrentFocusPath, getRectangle, isFocused, isMouseOver, keyReleased, mouseMoved, nextFocusPath, setFocused
Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
Methods inherited from interface net.minecraft.client.gui.components.Renderable
render
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
widgets
-
paddingY
protected int paddingY -
focussed
protected T extends net.minecraft.client.gui.layouts.LayoutElement & net.minecraft.client.gui.components.Renderable focussed
-
-
Constructor Details
-
ScrollableListWidget
public ScrollableListWidget(int x, int y, int width, int height) -
ScrollableListWidget
public ScrollableListWidget(int width, int height)
-
-
Method Details
-
addWidgets
-
setPaddingY
public void setPaddingY(int paddingY) -
getInnerHeight
protected int getInnerHeight()- Specified by:
getInnerHeight
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
getInnerHeightOfLayoutElementWidget
public int getInnerHeightOfLayoutElementWidget(net.minecraft.client.gui.layouts.LayoutElement widgetToGetHeightFor) -
scrollRate
protected double scrollRate()- Specified by:
scrollRate
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
renderContents
protected void renderContents(net.minecraft.client.gui.GuiGraphics gui, int mouseX, int mouseY, float partialTicks) - Specified by:
renderContents
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
renderBackground
protected void renderBackground(net.minecraft.client.gui.GuiGraphics p_282207_) - Overrides:
renderBackground
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) - Specified by:
mouseClicked
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
mouseClicked
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
scrollWidgetUponMouseClicked
Scrolls the scrollbar upon a widget being clicked.Find the position and height of the widget clicked and checks to see if its bottom y coordinate is past the bottom y coordinate of the scrollable list widget. If it is, it scrolls the scrollbar downward, and sets the scroll amount the difference in length between the two y coordinates. Otherwise, it scrolls the scrollbar upward to position the clicked widget towards the bottom of the scrollable list widget.
- Parameters:
element
- The widget clicked.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY) - Specified by:
mouseScrolled
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
mouseScrolled
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) - Specified by:
mouseDragged
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
mouseDragged
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) - Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
keyPressed
in classnet.minecraft.client.gui.components.AbstractScrollWidget
-
charTyped
public boolean charTyped(char character, int modifiers) -
findElementFor
-
findYFor
-
setFocussed
-
updateWidgetNarration
protected void updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput p_259858_) - Specified by:
updateWidgetNarration
in classnet.minecraft.client.gui.components.AbstractWidget
-
getWidgets
-
getMouseYTranslatedToWidgetY
public double getMouseYTranslatedToWidgetY(double mouseY) Gets the y position of the cursor relative to the scrollable list widget.- Parameters:
mouseY
- The y position of the cursor.- Returns:
- The cursor's y coordinate, where 0 is at the top of the scrollable list widget.
-
getElementY
Gets the y position of a widget relative to the scrollable list widget.- Parameters:
element
- The widget inside this scrollable list widget.- Returns:
- The y position of the widget, where 0 is at the top of the scrollable list widget.
-