UI Windows
Windows are used for inventory and container interfaces — a different system from custom pages. See Player Inventory for the inventory API and ItemStack documentation.
Window Types
Section titled “Window Types”| Type | Purpose |
|---|---|
Container | Generic container with slots |
PocketCrafting | 2x2 crafting grid |
BasicCrafting | 3x3 crafting grid |
DiagramCrafting | Recipe book interface |
StructuralCrafting | Building/structure crafting |
Processing | Furnace-like processing |
Memories | Memory storage UI |
Opening a Window
Section titled “Opening a Window”Player player = store.getComponent(ref, Player.getComponentType());WindowManager windowManager = player.getWindowManager();
ItemContainer container = new ItemContainer(27);ContainerWindow window = new ContainerWindow(container);windowManager.openWindow(ref, window, store);Closing Windows
Section titled “Closing Windows”// close by window IDwindowManager.closeWindow(ref, windowId, store);
// close all windowswindowManager.closeAllWindows(ref, store);Window Validation
Section titled “Window Validation”Windows can validate they’re still valid (player in range, block still exists):
public class MyWindow extends ContainerWindow implements ValidatedWindow {
@Override public boolean validate(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) { // return false to auto-close the window return this.block.exists() && this.isPlayerInRange(ref, accessor); }}Item Containers
Section titled “Item Containers”Windows work with ItemContainer for slot management:
ItemContainer container = new ItemContainer(slotCount);
// get/set itemsItemStack item = container.getItem(slot);container.setItem(slot, itemStack);
// listen for changescontainer.addListener((slot, oldItem, newItem) -> { // slot changed});Window Actions
Section titled “Window Actions”Handle player interactions:
| Action | Purpose |
|---|---|
CraftRecipeAction | Craft a recipe |
TierUpgradeAction | Upgrade item tier |
SelectSlotAction | Select a slot |
Block Windows
Section titled “Block Windows”For windows attached to blocks (chests, furnaces):
public class ChestWindow extends ContainerBlockWindow {
public ChestWindow(BlockRef blockRef, ItemContainer container) { super(blockRef, container); }
// window auto-closes if block is destroyed}Container Windows
Section titled “Container Windows”ContainerWindow opens an item container that the player can move items into and out of. Use this for actual item storage — chests, crates, shared stashes.
ItemContainer storage = new ItemContainer(27);ContainerWindow window = new ContainerWindow(storage);player.getPageManager().setPageWithWindows(ref, store, Page.Bench, true, window);
window.registerCloseEvent(event -> { // save contents, clean up, etc.});setPageWithWindows() opens the window and switches the client to the Bench page. The player can move items between the window container and their inventory.
Crafting Windows
Section titled “Crafting Windows”Crafting windows extend CraftingWindow. See Crafting & Recipes for the full recipe system, bench types, and crafting events.
| Window Class | Bench Type | Description |
|---|---|---|
SimpleCraftingWindow | Crafting | Grid-based, any-order ingredients |
DiagramCraftingWindow | DiagramCrafting | Slot-based with diagrams |
StructuralCraftingWindow | StructuralCrafting | 1 input -> multiple output options |
ProcessingBenchWindow | Processing | Fuel-based, runs without player |