Class GuiList<E>
- All Implemented Interfaces:
ElementEvents,GuiParent<GuiList<E>>,TooltipHandler<GuiList<E>>
The default converter simply displays the toString() value of the object.
Element width will be fixed to the width of the GuiList, element height can be whatever you want.
Note on adding child elements to this: If any child elements extend beyond the bounds of this element, that part will be culled. Also, child elements will always end up bellow the list items when the list is updated.
Created by brandon3055 on 21/09/2023
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanThis is made available primarily for debugging purposes where it can be useful to see what's going on behind the scenes.Fields inherited from class codechicken.lib.gui.modular.elements.GuiElement
hoverTime, initialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanYou can choose to attach a scroll bar to this element the same way you would aGuiScrollingBut sometimes you just want to be able to mouse-wheel scroll without an actual scroll bar.booleanblockMouseOver(GuiElement<?> element, double mouseX, double mouseY) Allows an element to override theGuiElement.isMouseOver()method of its children.Map<E, GuiElement<?>> getList()You are allowed to modify this list directly, but if you do you must callmarkDirty()otherwise the display elements will not get updated.doublevoidvoidbooleanvoidThis is the main render method that handles rendering this element and any child elements it may have.voidsetDisplayBuilder(BiFunction<GuiList<E>, E, ? extends GuiElement<?>> displayBuilder) setItemSpacing(double itemSpacing) voidtick(double mouseX, double mouseY) Called every tick to update the element.Methods inherited from class codechicken.lib.gui.modular.elements.GuiElement
addChild, addJeiDropTargets, addJeiExclusions, adoptChild, applyQueuedChildUpdates, blockMouseEvents, bringChildToForeground, font, getChildren, getCombinedElementDepth, getJeiDropConsumer, getModularGui, getParent, getTooltip, getTooltipDelay, hoverTime, initElement, isDescendantOf, isEnabled, isJeiDropTarget, isJeiExcluded, isMouseOver, isOpaque, isRemoved, isTooltipEnabled, jeiExclude, mc, onScreenInit, removeChild, renderChild, renderOverlay, scaledScreenHeight, scaledScreenWidth, sendChildToBackground, sendChildToIndex, setEnabled, setEnabled, setEnableToolTip, setJeiDropTarget, setJeiExcluded, setOpaque, setRenderCull, setTooltip, setTooltipDelay, setZStacking, showToolTip, toString, updateMouseOver, updateScreenData, zStackingMethods inherited from class codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry
addBoundsToRect, clearConstraints, clearGeometryCache, constrain, get, getChildBounds, getEnclosingRect, getParent, getPosition, getRectangle, placeInside, placeInside, placeOutside, placeOutside, setHeight, setPos, setSize, setWidth, setXPos, setYPos, strictMode, validate, xCenter, xMax, xMin, xSize, yCenter, yMax, yMin, ySizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface codechicken.lib.gui.modular.lib.ElementEvents
charTyped, charTyped, keyPressed, keyPressed, keyReleased, keyReleased, mouseClicked, mouseClicked, mouseMoved, mouseReleased, mouseReleased, mouseScrolled, mouseScrolledMethods inherited from interface codechicken.lib.gui.modular.lib.geometry.GuiParent
addChild, getValueMethods inherited from interface codechicken.lib.gui.modular.lib.TooltipHandler
renderTooltip, setTooltip, setTooltip, setTooltip, setTooltipSingle, setTooltipSingle
-
Field Details
-
enableScissor
public boolean enableScissorThis is made available primarily for debugging purposes where it can be useful to see what's going on behind the scenes.
-
-
Constructor Details
-
GuiList
-
-
Method Details
-
add
-
remove
-
getList
You are allowed to modify this list directly, but if you do you must callmarkDirty()otherwise the display elements will not get updated. -
markDirty
public void markDirty() -
setDisplayBuilder
public GuiList<E> setDisplayBuilder(BiFunction<GuiList<E>, E, ? extends GuiElement<?>> displayBuilder) -
setFilter
-
setItemSpacing
-
scrollState
-
addHiddenScrollBar
You can choose to attach a scroll bar to this element the same way you would aGuiScrollingBut sometimes you just want to be able to mouse-wheel scroll without an actual scroll bar.This method will add a hidden scroll bar to enable mouse wheel scrolling and middle-click dragging without the need for an actual scroll bar. The scroll bar will be an invisible zero width element on the right side of this list.
-
removeHiddenScrollBar
-
tick
public void tick(double mouseX, double mouseY) Description copied from class:GuiElementCalled every tick to update the element. Note this is called regardless of weather or not the element is actually enabled.- Overrides:
tickin classGuiElement<GuiList<E>>- Parameters:
mouseX- Current mouse X positionmouseY- Current mouse Y position
-
rebuildElements
public void rebuildElements() -
getElementMap
-
scrollTo
-
blockMouseOver
Description copied from interface:GuiParentAllows an element to override theGuiElement.isMouseOver()method of its children. This is primarily used for things like scroll elements where mouseover interactions need to be blocked outside the view area.- Specified by:
blockMouseOverin interfaceGuiParent<E>- Overrides:
blockMouseOverin classGuiElement<GuiList<E>>- Parameters:
element- The element on which isMouseOver is getting called.- Returns:
- true if mouse-over interaction should be blocked for this child element.
-
render
Description copied from class:GuiElementThis is the main render method that handles rendering this element and any child elements it may have. This method almost never needs to be overridden, instead when creating custom elements with custom rendering, your element should implementBackgroundRenderand / orForegroundRenderin or order to implement its rendering.Note: After the render is complete, the poseStack's z pos will be offset by the total depth of this element and its children. This is intended behavior,
- Overrides:
renderin classGuiElement<GuiList<E>>- Parameters:
render- Contains gui context information as well as essential render methods/utils including the PoseStack.mouseX- Current mouse X positionmouseY- Current mouse Y positionpartialTicks- Partial render ticks
-