How Schematics was built
Raw game files read
worldgen/schematics/**/*.json (header, BlockCodes and ItemCodes only for the pages; the whole file, gzip-compressed, for the 3D viewer)
Processing
A schematic is a pre-built block layout (worldgen/schematics/**/*.json) that world
generation pastes into the world. Each file is one page here, and
structures only reference them, by path or glob, together
with their own weight and quantity for that reference.
The page data comes from reading each file once, without parsing its large block arrays: the
bounding-box size, and the small BlockCodes and ItemCodes dictionaries (the block
and item codes it uses; ItemCodes holds items placed in containers, such as the
stackrandomizer-* placeholders). Which structures use a file is the reverse of those
references.
The 3D view
For the 3D view the whole file is needed, so every schematic is also written, gzip-compressed (about a fifth
of the original size), to the site and served as /assets/schematics/world/<domain>/<path>.json.gz.
The schematic viewer fetches one on demand
(?schematic=<domain>/<path>) and unpacks it in your browser with the browser's built-in
DecompressionStream. Nothing is decoded at build time beyond the tapestry, clutter and book
cross-references described on their own source pages.
Each schematic page also embeds a read-only preview (rotate, pan and zoom, nothing else) drawn from the same
file; the big ones wait until you ask for them. meta-filler blocks are a worldgen marker rather
than part of the finished structure, so they are left out of the preview and start hidden in the full viewer
(where you can turn them on from the block list).
The decoding, voxel conversion and 3D rendering code lives in the repository's vs-schematic package
(TypeScript, compiled for the browser at build time), separate from this wiki, so the same code also drives a
VS Code extension that previews schematic files.
One schematic at a time. A village is made of many schematics that the game places by its own rules; those layout rules aren't part of the data, so a structure is shown as the list of its pieces, not as an assembled whole. The files belong to the game and the mods that ship them.
Pipeline code
apps/vs-wiki/src/ingest/models/schematics.tsapps/vs-wiki/src/ingest/schematicHeader.tsapps/vs-wiki/src/ingest/schematicFiles.tsapps/vs-wiki/site/assets/schematicViewer.jsapps/vs-wiki/site/assets/schematicPreview.jslibs/vs-schematic/src/schematicVoxels.tslibs/vs-schematic/src/voxelViewer.tslibs/vs-schematic/src/schematicDecode.ts