Skip to content

Key Features

DarkBladeDev edited this page Dec 27, 2025 · 1 revision

Key features

Required modules

An addon must:

  1. Implement MultiblockAddon.
  2. Include addon.properties.
  3. Enforce namespacing:
    • actions/conditions: addonId:...
    • code-defined multiblocks: addonId:...
    • matcher prefix: addonId

Available extension points

1) Actions (ECA)

Registration:

ctx.registerAction("energy:energy_transfer", map -> new EnergyTransferAction(map));

YAML usage:

actions:
  on_tick:
    - type: energy:energy_transfer
      from: controller
      to: neighbors
      amount: 10

2) Conditions (ECA)

Registration:

ctx.registerCondition("energy:energy_greater_than", map -> new EnergyGreaterThanCondition(map));

YAML usage:

actions:
  on_interact:
    - type: message
      value: "&aYou have enough energy"
      conditions:
        - type: energy:energy_greater_than
          key: energy
          value: 100

3) Matchers

Registration:

ctx.registerMatcher("energy", token -> new EnergyWireMatcher(token));

Usage:

pattern:
  - offset: [1, 0, 0]
    match: "energy:wire_tier1"

Notes:

  • The parser tries to resolve prefix:value against registered matchers.
  • If there is no factory for the prefix, it falls back to the default behavior (material/tag/blockdata).

4) Code-defined multiblocks

var type = ctx
  .createMultiblock("cell")
  .version("1.0")
  .controller(new EnergyControllerMatcher())
  .pattern(new Vector(0, 1, 0), new EnergyCasingMatcher())
  .variable("energy", 0)
  .withCapability("energy", instance -> new EnergyStorage(instance))
  .build();

ctx.registerMultiblock(type);

Events and callbacks

Besides ECA, you can hook into Bukkit/Paper with listeners:

ctx.registerListener(new Listener() {
  @org.bukkit.event.EventHandler
  public void onInteract(com.darkbladedev.engine.api.event.MultiblockInteractEvent e) {
    // Implement domain logic without touching the core.
  }
});

Engine events (reference):

  • MultiblockFormEvent
  • MultiblockInteractEvent
  • MultiblockBreakEvent

Clone this wiki locally