Dynamic Multiblock System 1.21.1 not in 1.21.2–1.21.11 26.1
Availability
This module is available in Minecraft 1.21.1 and 26.1. Versions 1.21.2 through 1.21.11 were not synced due to development resource constraints. If you are using these versions, the dynamic multiblock feature is unavailable.
The package dev.anvilcraft.lib.v2.multiblock provides a dynamic multiblock structure system. It supports defining multiblock shapes via datapack or code, asynchronous block matching, automatic structure state tracking (formed/unformed), and network synchronization to clients.
Architecture Overview
- Definition (
MultiblockDefinition) -- Describes the blocks/predicates required at each relative position in the multiblock structure - Controller (
IController/SimpleController) -- The "brain" of the multiblock, binding a block + definition ID and providing formed/unformed callbacks - State (
MultiblockState) -- Runtime multiblock instance, tracking controller position, definition reference, and formed status - Manager (
DynamicMultiblockManager) -- Per-dimension global manager, persisted asSavedData - Async Detection -- Independent thread pool performs predicate matching to avoid blocking the main thread
- Network Sync --
MultiblockFormPacket/MultiblockUnformPacketsynchronize state to clients
Document Index
| Document | Content |
|---|---|
| Definition System | MultiblockDefinition, Builder, SeriaBuilder, serialization |
| Controller | IController, SimpleController, ControllerRecord |
| Runtime Management | DynamicMultiblockManager, MultiblockState, async detection, configuration |
Module Main Class
AnvilLibMultiblock
Mod entry point, @Mod("anvillib_multiblock").
java
public static final String MAIN_ID = "anvillib";
public static final String MOD_ID = "anvillib_multiblock";
public static final AnvilLibMultiblockConfig CONFIG;
public static Identifier of(String path); // → anvillib:<path>Quick Workflow
- Create a
MultiblockDefinition(Builder or SeriaBuilder) - Create a
SimpleControllersubclass and register it withControllerRecord - Place the definition JSON in the datapack at
data/<ns>/anvillib/definitions/(or register via code) - Place the controller block → the system automatically detects and triggers
onFormed/onUnformed
Notes
'0'orVec3i.ZEROin definitions represents the controller position- Adjust the async detection thread pool size based on the actual number of multiblocks
MultiblockStateis persisted asSavedData, surviving restarts- State changes are automatically synchronized to all online players via
IClientboundPacket