Repository navigation
build assembly
The assembly layer: converts the logic layer's ShapeSpec[] into real Blockbench Cube/Group objects.
The only module importing Cube / Group (depends on the Blockbench global API).
Moves the three parts into the new workspace as the curve-rendering base groups segment_left /
segment_right / tie (Create uses these three models for curve rendering), each holding all of its
part's elements (cubes + mesh groups), attached under the track parent group parent alongside the
directional shapes. Layout = the "near-the-x-axis half" track unit of the z_ortho straight track:
-
segment_left/segment_right: the rail model's center (xz (8,8) for Java, (0,0) otherwise) zeroed on x (offset.x = −xMid), near z end on the xy plane, bottom lifted to rail height + whole-model Y offset; each rail is pivoted at its own center (Create's segment_left/right.obj likewise center at x=0; the game positions them at ±gauge/2). -
tie: moved to the first tie position near the x axis of z_ortho (z=4 = tie interval / 2), centered at x=0, bottom only offset by the whole-model Y offset (not lifted).
export function buildBaseParts(
parent: Group,
parts: { left: PartModel; right: PartModel; tie: PartModel },
config: TrackConfig,
textureByKey?: Map<string, Texture>
): Group[];Generates all shapes under a parent Group (named after the current workspace, default 'track'). Each
shape is one child Group holding its cubes and the parts' mesh groups (specToMesh — the official
new Mesh + addVertices + addFaces(new MeshFace) API; vertices:{} is required or the Mesh constructor
adds a default 2×2×2 cube). For a Java Block/Item output workspace, the whole geometry is translated to
xz (8,8) so the model stays symmetric about the canvas center (inverse of the import normalization).
With textureByKey, the parts' source textures are applied to the matching faces.
export function buildAllShapes(shapes: ShapeSpec[], textureByKey?: Map<string, Texture>): Group;Converts Blockbench elements (Cube/Group/Mesh) into the logic layer's RawElement[] for part parsing
(used when extracting a part from the current project). Groups are expanded recursively; meshes are
serialized via getSaveCopy() with face textures as uuids (not indices).
export function elementsToRaw(elements: (Cube | Group | Mesh)[]): RawElement[];