Simple multiblocks
In Rebar, there are two classes that handle multiblock: RebarMultiblock and RebarSimpleMultiblock.
This page only covers RebarSimpleMultiblock as it is the simpler of the two and provides nice abstractions for working with multiblocks, while RebarMultiblock is far more flexible but also barebones.
Multiblock basics
In order to use RebarSimpleMultiblock, implement the interface on a block. Then, specify a list of components. For example:
This is the bare minimum needed to implement a simple multiblock. RebarSimpleMultiblock will automatically create and manage ghost blocks which show the player how to build the multiblock. Once a player builds your multiblock, all components of the multiblock will automatically be assigned the WAILA of the block that implements RebarSimpleMultiblock, which will revert if any part of the multiblock is broken.
Multiblock components
The MultiblockComponent class is flexible and can be used for detecting a range of different blocks.
Vanilla block
Rebar block
Vanilla block with specific block data
Vanilla block or rebar block
Vanilla block with specific block data or Rebar block
Multiblock direction
Multiblocks are inherently directional (unless all the components are on the Y axis). In order to set the direction of the multiblock, call setMultiblockDirection in your place constructor. For example:
By convention, you should also implement RebarDirectionalBlock and call setFacing alongside setMultiblockDirection. This will (among other things) allow your block to be textured according to the direction it is facing.
Performance
This warrants a mention as it is not immediately obvious: in Rebar, multiblocks do not have any significant performance overhead and the performance overhead scales very slow with size. In other words: multiblocks are not going to be measurably laggier than a regular block, and large multiblocks have performance comparable to small multiblocks.