Compatibility
Minecraft: Java Edition
1.21.11
Platforms
Supported environments
Client and server
Links
Tags
Creators
Details
Licensed MIT
Published 2 weeks ago
What it is
MenuKit: Containers (MKC) adds slot machinery to MenuKit. If you're building a Fabric mod with custom container UIs — storage blocks with new slot layouts, inventory mods that need per-slot state, anything that goes through a ScreenHandler — MKC provides:
MenuKitScreenHandler— a container-menu handler designed to integrate cleanly with MenuKit's panel system.MenuKitHandledScreen— the screen-side companion that combines MK panels with vanilla slots in one frame.- Per-slot state (M1). Server-authoritative state attached to individual slots; auto-synced to the client.
- Slot-group regions. Group slots into named regions and anchor MK panels to those regions, just like menu regions.
- Custom payloads. Typed networking primitives for slot state, ready to wire into your custom protocol.
- Contract verification. Built-in validators for slot/UI invariants.
MKC depends on MenuKit. Depending on MKC pulls in MenuKit transitively — you don't need both dependencies in your gradle build.
Install
Add the Modrinth Maven repository and the MKC dependency to your build.gradle:
repositories {
maven { url 'https://api.modrinth.com/maven' }
}
dependencies {
modImplementation 'maven.modrinth:menukit-containers:1.0.0'
// MenuKit is pulled in transitively via api — no need to declare it separately
}
And declare both dependencies in your src/main/resources/fabric.mod.json:
"depends": {
"menukit": "*",
"menukit-containers": "*"
}
MKC is universal (environment: *) — runs on both client and server. MenuKit stays client-only.
Quickstart
// 1. Define a screen handler by extending MenuKitScreenHandler
public class MyMenuHandler extends MenuKitScreenHandler {
public MyMenuHandler(int syncId, Inventory playerInventory, ContainerLevelAccess access) {
super(MY_MENU_TYPE, syncId, playerInventory);
// Register slots, set up storage attachments, etc.
// See MenuKitScreenHandler javadoc for the standard hooks.
}
}
// 2. Companion screen on the client
public class MyMenuScreen extends MenuKitHandledScreen<MyMenuHandler> {
public MyMenuScreen(MyMenuHandler handler, Inventory inventory, Component title) {
super(handler, inventory, title);
}
// Override panel layout if needed; default plays nicely with MK regions.
}
// 3. Open from the server side
player.openMenu(new SimpleMenuProvider((syncId, inv, p) ->
new MyMenuHandler(syncId, inv, accessor), Component.literal("My Menu")));
Feature highlights
- Custom container menus —
MenuKitScreenHandler+MenuKitHandledScreenfor clean integration with MK's panel system. - Per-slot state —
MKSlotStateattaches arbitrary state to individual slots; server-authoritative, auto-synced to the client (SlotStateBag,SlotStateClientCache). - Slot-group regions — group slots into named regions; anchor MK panels to those groups.
- Storage primitives —
Storage,KeyedStorage,PlayerStorage,EphemeralStorage,StorageAttachmentcover most container patterns. - Custom payloads —
SlotStateUpdateC2SPayload,SlotStateSnapshotS2CPayload,SlotStateUpdateS2CPayloadfor the slot-state protocol; pattern is reusable for your own typed payloads. - Contract verification —
ContractVerificationvalidates slot/UI invariants at runtime.
License
MIT. See LICENSE.
Issues
File issues at github.com/trevorschoeny/menukit-containers/issues.


