Json block behaviors Multiblock

From Vintage Story Wiki

This behavior supports creating a multiblock, whose selection and collision boxes are larger than 1x1x1. A block with this behavior is called the controller block of the multiblock. The shape of the controller block should cover the entire multiblock. When the controller block is placed, this behavior then extends the selection and collision blocks by surrounding the controller with filler blocks. The filler blocks forward events (such as right mouse clicks) back to the controller block.

A 5x1x5 multiblock with its controller surrounded by the filler blocks

Maximum multiblock size

The filler blocks have codes of the form "multiblock-monolithic-dx-dy-dz", where dx, dy, and dz refer to the offset of the filler block relative to the controller. For example, "multiblock-monolithic-n2-0-p1" is one of the variants.

Delta field ranges
Variant code Minimum Maximum
dx -2 2
dy -2 3
dz -2 -2

Technically the range of the delta fields allows a multiblock to be up to 5x6x5. However, the multiblock behavior will prevent placing the controller block if any non-replaceable block is in the way of the filler blocks. The player can only place new blocks adjacent to existing blocks. So if the multiblock is intended to be placed on top of the ground, then the valid range for the dy field is 0 to 3, and thus the maximum supported size is 5x4x5. If the multiblock is intended to be placed against a wall, then the maximum supported size is 5x6x3.

Only cuboid multiblock shapes are supported. For example, a multiblock L structure is not supported.

The behavior also handles part of destroying the multiblock. When the controller block is removed, the behavior will also remove all of the surrounding filler blocks. The filler blocks forward the OnBlockBroken event to the controller block, which then removes the controller block. This way if any of the filler blocks are broken or the controller block, then all of the blocks are removed and the controller block drops are only processed once.

Used by blocks

  • jonas-poweramplifier-bracket
  • jonas-poweramplifier-core
  • jonas-poweramplifier-gearbox
  • jonas-poweramplifier-sideend
  • riftward
  • verticalboiler (boiler used for distilling)
  • banner
  • trunk (double wide chest)
  • painting

Properties

sizex: (int, default: 3)
The east-west size of the multiblock. The maximum allowed value is 5.
sizey: (int, default: 3)
The up-down size of the multiblock. The maximum allowed value is 6.
sizez: (int, default: 3)
The north-south size of the multiblock. The maximum allowed value is 5.
type: (string, default: "monolithic")
The only allowed value is "monolithic".
cposition: (Vec3i, default: [1, 0, 1])
The offset of the controller block relative to the north-west-bottom corner of the multiblock. For example, for a [2, 2, 2] sized multiblock, a cposition of [1, 0, 1] would put the controller on the south-east-bottom corner of the multiblock.

Forwarded events

By default the filler blocks will forward events to the regular event handlers on the controller block. Usually this is the correct behavior. However, if the controller block or one of its block behaviors (block entity behaviors are not included) implements the corresponding MB interface, then the events are forwarded to that interface instead. This allows the controller block to specialize the behavior based on which part of the multiblock was interacted with.

MB interfaces:

Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository