Class TScreenPlus
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreen
io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenPlus
- All Implemented Interfaces:
TParentElement
,IEnableStateProvider
- Direct Known Subclasses:
TestTScreen
,TFileChooserScreen
Same as
TScreen
, but with some extra features
such as arrow-key navigation. May cost extra performance.-
Field Summary
Fields inherited from class io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreen
children, client, title
Fields inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
MAX_CHILD_NESTING_DEPTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable TElement
findClosestSideElement
(TElement target, Direction2D direction) Same asfindClosestSideElement(TElement, Direction2D, Predicate)
, except this method uses theDEFAULT_FCSE_PREDICATE
that requires the returnedTElement
to be enabled and focusable.@Nullable TElement
findClosestSideElement
(TElement target, Direction2D direction, Predicate<TElement> predicate) Finds and returns theTElement
nearest to the specified targetTElement
, in the givenDirection2D
.
The method will iterate through all children elements on theTScreen
and locate the element closest to the target in the specified direction.boolean
input
(TInputContext inputContext) An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreen
__postTabNavigation, close, createScreenWrapper, filesDragged, getAsScreen, getChildren, getClient, getDraggingElement, getEnabled, getFocusedElement, getHeight, getHoveredElement, getItemRenderer, getMousePosition, getParent, getTextRenderer, getTitle, getWidth, getX, getY, getZIndex, hasKeyDown, hasWndDown, init, inputTabNavigation, isEnabled, isOpen, onClosed, onOpened, render, renderBackground, renderChildren, renderTooltip, setFocusedElement, setFocusedElement, shouldCloseOnEsc, shouldPause, shouldRenderInGameHud, tick
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
addChild, addChild, clearChildren, findChild, findLastChild, findParent, findParentTElement, forEachChild, getEndX, getEndY, input, removeChild, removeChild
-
Constructor Details
-
TScreenPlus
public TScreenPlus(net.minecraft.text.Text title)
-
-
Method Details
-
input
Description copied from interface:TParentElement
An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.- Specified by:
input
in interfaceTParentElement
- Overrides:
input
in classTScreen
- Parameters:
inputContext
- TheTInputContext
containing information about a given input.- See Also:
-
findClosestSideElement
Same asfindClosestSideElement(TElement, Direction2D, Predicate)
, except this method uses theDEFAULT_FCSE_PREDICATE
that requires the returnedTElement
to be enabled and focusable.- Parameters:
target
- See below...direction
- See below...- See Also:
-
findClosestSideElement
@Nullable public @Nullable TElement findClosestSideElement(TElement target, Direction2D direction, Predicate<TElement> predicate) Finds and returns theTElement
nearest to the specified targetTElement
, in the givenDirection2D
.
The method will iterate through all children elements on theTScreen
and locate the element closest to the target in the specified direction.For example, if the direction is
Direction2D.RIGHT
, the method will find the element nearest to the target that is to the right of it.- Parameters:
target
- The targetTElement
for which the closest side element needs to be found.direction
- TheDirection2D
in which to search for the nearest element.predicate
- ThePredicate
the returnedTElement
must match.- Returns:
- The nearest
TElement
to the target in the specified direction, ornull
if no such element is found.
-