Nucleation
A Minecraft schematic engine in Rust — load, build, simulate, mesh, and render schematics from seven languages.
This island is a 20-line JSON description. Every image in this README was built
and rendered by nucleation itself — regenerate them all with
tools/readme-media/generate.py.
Install
Kotlin/JVM, PHP, C, and C++ ship as archives on Releases — quickstarts below.
Thirty seconds
=
=
# (3, 3, 3)
# ["minecraft:air","minecraft:stone",...]
# format from extension
Same thing from JavaScript (the WASM build has no filesystem — bytes in, bytes out):
import from "nucleation";
import from "node:fs";
const cube = ;
cube.;
;
Every snippet in this README is executed in CI-adjacent tooling with its real output
captured — the full set, with outputs, lives in
docs/readme-snippets/.
Sculpt with shapes and brushes
Spheres, tori, cones, pyramids, bezier ribbons — combined with boolean ops, filled by brushes: solid, color-matched, gradient, or shaded. This torus is twelve rainbow gradient points snapped to the wool palette:
, = ,
= 2 * * / 12
, , =
+=
+=
=
=
Terrain from a JSON description
Signed distance fields: primitives, smooth booleans, seeded noise — sampled into blocks through declarative material rules (surface shells, depth bands, gradients, flower scatter). Deterministic: same JSON, same island, every language.
=
=
=
# → 29×18×29, 6,927 blocks
Paint with palettes
Palettes turn colors into blocks: presets (wool, concrete, terracotta, wood, solid, …), tag/kind-filtered custom sets, lightness-sorted ramps, and gradient sampling — the value→block workflow behind heatmaps, fractals, and pixel art.
=
# → orange_wool, red_wool, red_wool, red_wool, magenta_wool, purple_wool, purple_wool, blue_wool
Index a ramp by any value you like — say, Mandelbrot escape time:
Edit without collateral damage
Masked fills touch only what you tell them to: fill_only_air builds around
existing work, fill_replacing swaps listed blocks inside a shape — here, stone
bricks weathering into mossy and cracked variants within a sphere:
Ask the block database
Block facts for all 1,196 Minecraft 26.2 blocks, extracted from Mojang's own data generator and the vanilla jars — kinds, base-block variant links, resolved tags, model-derived geometry, texture-derived colors:
# {"kind": "minecraft:stair", "base_block": "minecraft:oak_planks",
# "tags": ["minecraft:mineable/axe", "minecraft:stairs", "minecraft:wooden_stairs"],
# "full_cube": false, "color": [162, 131, 79],
# "default_state": {"facing": "north", "half": "bottom", ...}, ...}
# [oak_planks, oak_button, oak_fence, oak_fence_gate, oak_pressure_plate, oak_slab, oak_stairs, ...]
The data refreshes itself: a weekly workflow watches Mojang's version manifest and opens a PR with regenerated data when a new Minecraft ships (how it works).
Simulate redstone
Headless circuit simulation via MCHPRS's redpiler — flip levers, tick, read lamps; or drive whole circuits through a typed executor with named inputs and outputs. Works in the browser (WASM) too:
import from "nucleation";
const circuit = ;
circuit.;
circuit.;
circuit.;
circuit.;
const world = ;
world.; // flip the lever
world.;
world.;
world.; // → true
Diff, fingerprint, deduplicate
Structural diffs (added / removed / changed / swapped, translation-aware) and translation-invariant fingerprints for duplicate detection:
=
# 1
# False
# "3fdae2c9855e4794b30f9895b0d31a2c"
Mesh and render
Any schematic → GLB/glTF or USDZ using any vanilla-format resource pack, and a headless GPU renderer for PNG previews — the one that drew every image on this page:
=
= # 9,848 bytes, magic b'glTF'
=
Formats and worlds
| Schematics | .litematic · Sponge .schem · WorldEdit .schematic · Bedrock .mcstructure · structure .nbt · .nusn (fast binary snapshot) — with auto-detection |
| Worlds | import Anvil region files / world folders (optionally bounded), export schematics as playable worlds, stream chunk-by-chunk in constant memory |
| Versions | convert blocks, block entities, items, and entities across Minecraft data versions (a Rust port of PaperMC's DataConverter), with loss reports |
| Bedrock | Java ↔ Bedrock blockstate + block-entity translation via GeyserMC mappings (full 26.2 parity) |
And more: auto-stack (detect a build's repeating lattice and restamp it bigger — a 4-bit adder into an 8-bit one), embedded scripting (generate schematics from Lua or JS scripts, palettes included), pluggable storage (memory / filesystem / S3 / Redis / Postgres behind one URI), and layer-art templates (schematics from ASCII art).
One API, seven languages
Every binding is generated from one annotated-Rust source of truth
(src/bridge/) via Diplomat —
committed, regenerated, and diffed in CI so they can never drift. Same types, same
methods, per-language idioms:
| Language | Package | Errors | Naming |
|---|---|---|---|
| Rust | nucleation crate (native API) |
Result |
snake_case |
| JavaScript | npm install nucleation |
exceptions | setBlock |
| Python | pip install nucleation |
exceptions | set_block |
| Kotlin/JVM | Release JAR (JNA, 5 platforms bundled) | kotlin.Result |
setBlock |
| PHP | Release archive (php/ + FFI) |
DiplomatError |
setBlock |
| C | Release archive (include/ + library) |
result structs | Schematic_set_block |
| C++ | Header-only over the C ABI | diplomat::result |
set_block |
import at.schem.nucleation.*
val schematic = Schematic.create("demo")
schematic.setBlock(1, 2, 3, "minecraft:stone").getOrThrow()
println(schematic.getBlockName(1, 2, 3).getOrThrow()) // "minecraft:stone"
int
What ships where: npm, PyPI, the release archives, and the JAR carry the full
surface (schematics, formats, worlds, building, palettes, SDF, diff/fingerprint,
meshing, simulation, rendering). The crates.io crate has meshing and rendering;
simulation is git-only (nucleation = { git = "https://github.com/Schem-at/Nucleation", features = ["simulation"] })
because MCHPRS isn't on crates.io. The WASM build includes simulation and meshing;
GPU rendering is native-only.
Documentation & development
- Documentation index — per-language references and feature guides
- The Minecraft block database — where the data comes from and how it self-updates
docs/readme-snippets/— every README snippet with its verified output
CI regenerates bindings and fails on drift, exercises every built wheel and the assembled JAR before release, and runs the language smoke tests on every push.
License
MIT. See LICENSE.