Skip to content

UI System

DarkBladeDev edited this page Aug 2, 2026 · 4 revisions

🖥️ UI System (mbe-ui)

Note

Architectural Shift: MultiBlockEngine is transitioning towards a declarative configuration model (e.g., configuring interfaces directly via inventories.yml) to reduce the dependency on heavy, hardcoded UI addons. While the mbe-ui addon still exists, expect a shift towards lightweight, generic inventory binding in future updates.

The mbe-ui addon provides a decoupled, reflection-safe UI system that allows creating dynamic menus and panels for your multiblocks with zero InventoryView versioning headaches across Minecraft versions.

✨ Features

  • Version Independent: Works seamlessly from 1.20 to 1.21.1+.
  • Dynamic Bindings: Link UI elements directly to multiblock variables or states.
  • Template Based: Define your UI layouts entirely in YAML.

🧱 YAML Configuration

UI panels are typically defined in plugins/MultiBlockEngine/panels/:

id: simple_furnace_panel
title: "Furnace Status"
rows: 3

elements:
  - slot: 13
    material: BLAST_FURNACE
    display_name: "&eMachine State: &f<state>"
    lore:
      - "&7Stored Energy: &a<variable:energy_stored>"
    actions:
      - type: "toggle_state"

Placeholders

You can use dynamic placeholders in display_name and lore:

  • <state>: The current ACTIVE/INACTIVE state.
  • <variable:name>: The value of a multiblock variable.
  • <metadata:key>: Any persistent metadata attached to the instance via PDC.

🛠️ Opening a Panel

You can open a panel via an action in your multiblock definition:

on_interact:
  - type: open_panel
    panel: "simple_furnace_panel"

🧰 Tooling & UI Inputs

  • Inventory Exporter (mbe-ui-inventory-exporter): Allows administrators to convert in-game container layouts directly into reusable YAML panel definitions.
  • Interactive UI Inputs: Supports modal text and numeric input bindings for multiblock parameter configuration directly within panels.

💻 Developer API

Tip

UI services and registries (PanelViewService, PanelDirectoryRegistry, etc.) have been fully extracted to the dev.darkblade.mbe.api.ui package, making them first-class citizens of the platform-agnostic API.

To register custom bindings or handle UI events in Java, you must have the mbe-ui addon installed and inject its service:

@InjectService
private PanelViewService uiService;

public void openCustomUI(Player player, MultiblockInstance instance) {
    uiService.openPanel(player, "my_custom_id", instance);
}

Clone this wiki locally