Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ryanhcode/sable/llms.txt
Use this file to discover all available pages before exploring further.
SubLevelAssemblyHelper provides static utility methods for the two phases of sub-level creation: discovering which blocks belong together (gathering) and moving them into a new sub-level (assembly). The typical workflow calls gatherConnectedBlocks() first to identify a block set, inspects the GatherResult, and then passes the result to assembleBlocks().
assembleBlocks
anchor block is placed at the center of the sub-level’s plot; all other blocks are translated relative to it. Tracking points and retained entities within bounds are moved along with the blocks.
If the anchor is already inside another sub-level, the new sub-level inherits that sub-level’s pose and velocity and is recorded as a split.
The server level that currently contains the blocks to be assembled.
The block that will map to the center of the new sub-level’s plot. All other block positions are offset relative to this anchor.
Every block position to move into the sub-level. Typically the
blocks set from a GatherResult.Integer-precision bounding box used to determine which tracking points and hanging entities should be relocated. Typically the
boundingBox from a GatherResult.ServerSubLevel.
The container must be non-null (i.e., the level must have a
SubLevelContainer attached) or an assertion error is thrown. In normal gameplay this is always satisfied for server levels.gatherConnectedBlocks
gatherOrigin, expanding to all non-air blocks connected within a 3×3×3 neighbourhood. Pure-corner diagonals (where |dx| + |dy| + |dz| = 3) are excluded from connectivity, so only face and edge neighbours can propagate the frontier. Air blocks are never added to the result.
The block position from which gathering begins. If this position is air, the method returns immediately with
State.NO_BLOCKS.The server level to read block states from.
Hard cap on the number of blocks that may be gathered. If the search would exceed this limit, gathering stops immediately and the result carries
State.TOO_MANY_BLOCKS.An optional filter evaluated for each candidate neighbour. Pass
null to accept all non-air connections. See FrontierPredicate below.GatherResult.
GatherResult
gatherConnectedBlocks().
The set of block positions gathered.
null when assemblyState is not SUCCESS.The total number of blocks inspected during the search, including those rejected by the predicate or the air check.
The axis-aligned integer bounding box enclosing all gathered blocks.
null when assemblyState is not SUCCESS.Indicates whether gathering succeeded or failed, and why.
GatherResult.State
| Value | Description |
|---|---|
SUCCESS | Gathering completed within the block limit and found at least one block. |
TOO_MANY_BLOCKS | The search reached maximumBlocksToAssemble before completing. blocks and boundingBox are null. |
NO_BLOCKS | The gather origin was air, or the search completed with an empty result. |
FrontierPredicate
true to allow the connection and add pos to the frontier, or false to block it.
The position of the block that is attempting to expand into
pos.The block state at
originPos.The candidate neighbour position being evaluated.
The block state at
pos.The cardinal direction from
originPos to pos, or null when the connection is along an edge diagonal (|dx| + |dy| + |dz| = 2). Pure-corner diagonals are never evaluated.AssemblyTransform
assembleBlocks() constructs this automatically; you only need to instantiate it directly if you are building a custom assembly pipeline.
The anchor block position in the source level.
The position in the destination level (plot center) that
anchorPos maps to.Number of 90° counter-clockwise increments to rotate around the Y axis.
The Minecraft
Rotation equivalent of angle, used for rotating individual block states.The destination level — typically the level that owns the target sub-level’s plot.
apply methods
| Signature | Description |
|---|---|
Vec3 apply(Vec3 pos) | Translates and rotates a continuous position from source space to destination space. |
BlockPos apply(BlockPos pos) | Converts a block position via the continuous overload and rounds to the nearest block. |
BlockState apply(BlockState state) | Rotates a block state using the transform’s Rotation, with special handling for bell attachment types. |
Internal helpers
The following methods are used internally byassembleBlocks(). They are public but not intended for direct use:
moveBlocks(ServerLevel, AssemblyTransform, Iterable<BlockPos>)— copies block states and block entity data to the destination level, then replaces source blocks with air.moveTrackingPoints(ServerLevel, BoundingBox3ic, ServerSubLevel, AssemblyTransform)— relocates saved tracking points that fall withinboundsinto the sub-level’s local coordinate space.
