Skip to content

ContainerPanel

@Composable



fun ContainerPanel(
    contentWidth: Int = DEFAULT_CONTENT_WIDTH, 
    modifier: Modifier = Modifier, 
    content: @Composable



 () -> Unit
)

A complete container screen layout following the vanilla chest-screen pattern.

Combines the screen contents (top section) with the player inventory (bottom section), properly positioned and spaced. Automatically sets the game's label positions (AbstractContainerScreen.titleLabelX/AbstractContainerScreen.titleLabelY and AbstractContainerScreen.inventoryLabelX/AbstractContainerScreen.inventoryLabelY) based on the layout.

The game then renders the labels using the title and inventory label components.

Layout Structure

┌─────────────────────────────────┐
│ [Screen Contents]               │  <- titleLabelX/Y set here
├─────────────────────────────────┤  <- contentSpacing
│ [Player Inventory 3×9]          │  <- inventoryLabelX/Y set here
│ [spacing]                       │
│ [Hotbar 1×9]                    │
└─────────────────────────────────┘

Parameters

  • contentWidth: Width of the panel's content area, in pixels. Defaults to 9 slots wide.

  • modifier: Additional modifiers applied to the outer container.

  • content: The screen contents composable (container inventory, custom widgets, etc.).