Class TScreen
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreen
- All Implemented Interfaces:
TParentElement
,IEnableStateProvider
- Direct Known Subclasses:
TDialogBoxScreen
,TScreenPlus
,TStackTraceScreen
,TWidgetHudScreen
-
Field Summary
Modifier and TypeFieldDescriptionprotected final TElementList
protected @Nullable net.minecraft.client.MinecraftClient
protected @Nullable net.minecraft.text.Text
Fields inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
MAX_CHILD_NESTING_DEPTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Temporary workaround code for assisting theTParentElement
andTContextMenuPanel
element's behaviors.void
close()
protected TScreenWrapper
<?> boolean
filesDragged
(Collection<Path> files) Invoked when the user drags files onto the currently openedTScreen
.final net.minecraft.client.gui.screen.Screen
final TElementList
final @Nullable net.minecraft.client.MinecraftClient
final @Nullable TElement
final boolean
Returns true if thisObject
is enabled.final @Nullable TElement
final int
final @Nullable TElement
final net.minecraft.client.render.item.ItemRenderer
final Point
final @Nullable TParentElement
final net.minecraft.client.font.TextRenderer
final net.minecraft.text.Text
getTitle()
final int
getWidth()
final int
getX()
final int
getY()
final float
There's no need for a z-index forTScreen
s, so here it returns 0.static boolean
hasKeyDown
(int keyCode) static boolean
protected abstract void
init()
boolean
input
(TInputContext inputContext) An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.protected final boolean
inputTabNavigation
(boolean reverse) Used for handling "tab navigation".final boolean
Returnstrue
ifTParentElement.getEnabled()
returnstrue
, andTParentElement.getParent()
'sTParentElement.isEnabled()
also returnstrue
.final boolean
isOpen()
protected void
onClosed()
protected void
onOpened()
void
render
(TDrawContext pencil) Renders thisTScreen
.void
renderBackground
(TDrawContext pencil) Renders thisTScreen
's background.protected final void
renderChildren
(TDrawContext pencil) Renders all children elements of thisTScreen
.protected final void
renderTooltip
(TDrawContext pencil) Renders theTooltip
for the currently selected or hoveredTElement
.final boolean
setFocusedElement
(TElement child) final boolean
setFocusedElement
(TElement child, boolean askToFocus) boolean
boolean
boolean
protected void
tick()
Invoked whenever thisTScreen
ticks.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
-
Field Details
-
client
@Nullable protected @Nullable net.minecraft.client.MinecraftClient client -
children
-
title
@Nullable protected @Nullable net.minecraft.text.Text title
-
-
Constructor Details
-
TScreen
public TScreen(net.minecraft.text.Text title)
-
-
Method Details
-
createScreenWrapper
-
getAsScreen
public final net.minecraft.client.gui.screen.Screen getAsScreen() -
getClient
@Nullable public final @Nullable net.minecraft.client.MinecraftClient getClient() -
getTextRenderer
public final net.minecraft.client.font.TextRenderer getTextRenderer() -
getItemRenderer
public final net.minecraft.client.render.item.ItemRenderer getItemRenderer() -
getTitle
public final net.minecraft.text.Text getTitle() -
isEnabled
public final boolean isEnabled()Description copied from interface:TParentElement
Returnstrue
ifTParentElement.getEnabled()
returnstrue
, andTParentElement.getParent()
'sTParentElement.isEnabled()
also returnstrue
.In other words, this will return
true
if both this element and all of itsTParentElement
s are enabled.- Specified by:
isEnabled
in interfaceTParentElement
-
getEnabled
public final boolean getEnabled()Description copied from interface:IEnableStateProvider
Returns true if thisObject
is enabled.- Specified by:
getEnabled
in interfaceIEnableStateProvider
- Specified by:
getEnabled
in interfaceTParentElement
-
close
public void close() -
onOpened
protected void onOpened() -
onClosed
protected void onClosed() -
shouldPause
public boolean shouldPause() -
shouldCloseOnEsc
public boolean shouldCloseOnEsc() -
shouldRenderInGameHud
public boolean shouldRenderInGameHud() -
isOpen
public final boolean isOpen() -
getMousePosition
-
getParent
- Specified by:
getParent
in interfaceTParentElement
-
getChildren
- Specified by:
getChildren
in interfaceTParentElement
-
getX
public final int getX()- Specified by:
getX
in interfaceTParentElement
-
getY
public final int getY()- Specified by:
getY
in interfaceTParentElement
-
getWidth
public final int getWidth()- Specified by:
getWidth
in interfaceTParentElement
-
getHeight
public final int getHeight()- Specified by:
getHeight
in interfaceTParentElement
-
getDraggingElement
-
getHoveredElement
-
getFocusedElement
-
setFocusedElement
-
setFocusedElement
-
init
protected abstract void init() -
tick
protected void tick()Invoked whenever thisTScreen
ticks.Same as
Screen.tick()
.- See Also:
-
getZIndex
public final float getZIndex()There's no need for a z-index forTScreen
s, so here it returns 0.- Specified by:
getZIndex
in interfaceTParentElement
-
render
- Specified by:
render
in interfaceTParentElement
- Parameters:
pencil
- TheTDrawContext
.
-
renderBackground
Renders thisTScreen
's background.Should be called before rendering children in
render(TDrawContext)
.- Parameters:
pencil
- TheTDrawContext
.- See Also:
-
renderChildren
Renders all children elements of thisTScreen
. -
renderTooltip
Renders theTooltip
for the currently selected or hoveredTElement
.- See Also:
-
input
Description copied from interface:TParentElement
An input handler that handles inputs on theTInputContext.InputDiscoveryPhase.MAIN
input phase.- Specified by:
input
in interfaceTParentElement
- Parameters:
inputContext
- TheTInputContext
containing information about a given input.- See Also:
-
filesDragged
Invoked when the user drags files onto the currently openedTScreen
.- Parameters:
files
- ThePath
Collection
of the files that were dragged.- Returns:
- True if the event was handled, and false otherwise.
-
hasKeyDown
public static boolean hasKeyDown(int keyCode) -
hasWndDown
public static boolean hasWndDown()
-