Core types
MultiblockDefinition
MultiblockDefinition is a record that pairs a ResourceLocation ID with a Layout. An optional objectFactory supplies a Multiblock behavior object when the structure forms.
Constructors
Validation methods
Layout
Layout describes the 3D block pattern as a character grid. Build one with Layout.builder().
Coordinate conventions:
- X increases east; comes from column index within a row string.
- Z increases south; comes from row index within a layer.
- Y increases upward; comes from layer index (0 = bottom).
' '(space) — position is ignored; no block check is performed.- The anchor character (if set) marks the layout origin and is also skipped during validation.
Builder API
| Builder method | Description |
|---|---|
layer(String... rows) | Add one horizontal layer. All layers must share the same width and depth. |
key(char symbol, BlockPredicate predicate) | Map a character to a predicate. |
key(char symbol, Block block) | Convenience overload; creates BlockPredicate.of(block). |
key(char symbol, BlockDefinition<?> block) | Convenience overload for BlockDefinition. |
anchor(char symbol) | Mark a character as the anchor; it must appear exactly once. |
build() | Construct and validate the Layout. |
Layout accessors
BlockPredicate
BlockPredicate is a functional interface used to validate whether a world block matches a pattern position.
Factory methods
Composition
MultiblockValidator
MultiblockValidator validates a Layout against actual world blocks. The base (unrotated) layout is assumed to face south.
ValidationResult
MultiblockManager
MultiblockManager drives automatic detection, formation, and destruction. Initialize it once during mod setup.
BlockEvent.BreakEvent, BlockEvent.EntityPlaceEvent, ServerTickEvent.Post, PlayerInteractEvent.RightClickBlock, and LevelEvent.Load automatically after init() is called.
MultiblockWorldData
MultiblockWorldData extends SavedData and persists active multiblock positions across server restarts. It is managed automatically by MultiblockManager.
RotationUtil
RotationUtil converts layout-space coordinates to world-space coordinates and back, handling all four horizontal facings and optional X-axis mirroring.
| Facing | World X | World Z |
|---|---|---|
| SOUTH | x | z |
| WEST | z | -x |
| NORTH | -x | -z |
| EAST | -z | x |
(x, z) → (-x, z).
Workflow
Define the layout
Use
Layout.builder() to describe the 3D pattern with character layers and BlockPredicate keys.Create a MultiblockDefinition
Wrap the layout in a
MultiblockDefinition with a unique ResourceLocation ID. Optionally supply an objectFactory for behavior callbacks.Register the definition
Register your definition in
CoreRegistries.MULTIBLOCK_DEFINITIONS using a DeferredRegister.Initialize MultiblockManager
Call
MultiblockManager.init(modEventBus) in your mod constructor so event listeners are attached.Code example: defining a 3×3×3 smelter multiblock
MultiblockManager can discover it: