ComposeContainerScreen¶
abstract class ComposeContainerScreen<T : AbstractContainerMenu>(
menu: T,
playerInventory: Inventory,
title: Component,
val asynchronous: Boolean = true
) : AbstractContainerScreen<T> , CoroutineScope
A Compose-driven AbstractContainerScreen base class with layer support, async recomposition, and full pointer/keyboard input dispatch.
Use this when your screen is backed by a AbstractContainerMenu (for inventory slots, crafting grids, etc.). The Compose UI is rendered from renderBg so it appears behind vanilla slot highlights but above the background.
class MyContainerScreen(
menu: MyMenu, inventory: Inventory, title: Component,
) : ComposeContainerScreen<MyMenu>(menu, inventory, title) {
override fun init() {
super.init()
start { MyContainerContent(menu) }
}
}
Parameters¶
-
T: The AbstractContainerMenu subtype.
-
menu: The container menu instance.
-
playerInventory: The opening player's inventory.
-
title: The screen title.
-
asynchronous: When
true(default), recomposition runs off the main thread.
Constructors¶
ComposeContainerScreen¶
Parameters
-
T: The AbstractContainerMenu subtype.
-
menu: The container menu instance.
-
playerInventory: The opening player's inventory.
-
title: The screen title.
-
asynchronous: When
true(default), recomposition runs off the main thread.
Properties¶
asynchronous¶
val asynchronous: Boolean
Parameters
- asynchronous: When
true(default), recomposition runs off the main thread.
backgroundMusic¶
@get:
Nullable
open val backgroundMusic: Music?
coroutineContext¶
override val coroutineContext: CoroutineContext
currentFocusPath¶
@get:
Nullable
open val currentFocusPath: ComponentPath?
focused¶
@get:
Nullable
open var focused: GuiEventListener?
height¶
isDragging¶
var isDragging: Boolean
isFocused¶
isPauseScreen¶
open override val isPauseScreen: Boolean
menu¶
narrationMessage¶
open val narrationMessage: Component?
rectangle¶
open val rectangle: ScreenRectangle?
tabOrderGroup¶
open val tabOrderGroup: Int
title¶
open val title: Component?
width¶
Functions¶
added¶
open fun added()
afterKeyboardAction¶
open fun afterKeyboardAction()
afterMouseAction¶
open fun afterMouseAction()
afterMouseMove¶
open fun afterMouseMove()
charTyped¶
children¶
clearDraggingState¶
open fun clearDraggingState()
clearFocus¶
open fun clearFocus()
getChildAt¶
open fun getChildAt(mouseX: Double, mouseY: Double): Optional<GuiEventListener?>?
getMenu¶
handleComponentClicked¶
open fun handleComponentClicked(@Nullable
style: Style?): Boolean
handleDelayedNarration¶
open fun handleDelayedNarration()
init¶
isMouseOver¶
open fun isMouseOver(mouseX: Double, mouseY: Double): Boolean
keyPressed¶
open override fun keyPressed(
keyCode: Int,
scanCode: Int,
modifiers: Int
): Boolean
keyReleased¶
open override fun keyReleased(
keyCode: Int,
scanCode: Int,
modifiers: Int
): Boolean
mouseClicked¶
open override fun mouseClicked(
mouseX: Double,
mouseY: Double,
button: Int
): Boolean
mouseDragged¶
mouseMoved¶
open override fun mouseMoved(mouseX: Double, mouseY: Double)
mouseReleased¶
open override fun mouseReleased(
mouseX: Double,
mouseY: Double,
button: Int
): Boolean
mouseScrolled¶
nextFocusPath¶
@Nullable
open fun nextFocusPath(event: FocusNavigationEvent?): ComponentPath?
onClose¶
open override fun onClose()
onFilesDrop¶
open fun onFilesDrop(packs: List<Path?>?)
removed¶
open fun removed()
render¶
renderBackground¶
open fun renderBackground(
guiGraphics: GuiGraphics?,
mouseX: Int,
mouseY: Int,
partialTick: Float
)
renderNodes¶
open fun renderNodes(
guiGraphics: GuiGraphics,
mouseX: Int,
mouseY: Int,
partialTick: Float
)
Measures and renders all active layers. Called from renderBg so that the Compose UI is drawn before vanilla item/slot overlays.
renderTransparentBackground¶
open fun renderTransparentBackground(guiGraphics: GuiGraphics?)
renderWithTooltip¶
fun renderWithTooltip(
guiGraphics: GuiGraphics?,
mouseX: Int,
mouseY: Int,
partialTick: Float
)
resize¶
setTooltipForNextRenderPass¶
open fun setTooltipForNextRenderPass(tooltip: List<FormattedCharSequence?>?)
open fun setTooltipForNextRenderPass(tooltip: Component?)
open fun setTooltipForNextRenderPass(
tooltip: List<FormattedCharSequence?>?,
positioner: ClientTooltipPositioner?,
override: Boolean
)
open fun setTooltipForNextRenderPass(
tooltip: Tooltip?,
positioner: ClientTooltipPositioner?,
override: Boolean
)
shouldCloseOnEsc¶
open fun shouldCloseOnEsc(): Boolean
tick¶
fun tick()
triggerImmediateNarration¶
open fun triggerImmediateNarration(onlyNarrateNew: Boolean)
updateNarratorStatus¶
open fun updateNarratorStatus(narratorEnabled: Boolean)