nucleation 0.3.13

A high-performance Minecraft schematic parser and utility library
Documentation
[package]
name = "nucleation"
version = "0.3.13"
edition = "2021"
description = "A high-performance Minecraft schematic parser and utility library"
authors = ["Nano nano@schem.at"]
license = "MIT"
repository = "https://github.com/Schem-at/Nucleation"
readme = "README.md"
keywords = ["minecraft", "schematic", "parser", "voxel"]
categories = ["game-development", "parser-implementations", "wasm"]
# Explicit allowlist: the repo carries generated bindings, test samples, and
# packaging trees that ballooned `cargo package` to 448 MB compressed —
# crates.io rejects anything over 10 MB. Only the library sources ship.
include = [
    "src/**",
    "build.rs",
    "data/blockpedia/**",
    "tools/mc-data/**",
    "Cargo.toml",
    "README.md",
    "LICENSE",
    "RELEASE_NOTES.md",
]

[lib]
# staticlib: linked into the Python (nanobind) extension so the wheel is self-contained.
crate-type = ["cdylib", "staticlib", "rlib"]

[features]
default = ["store-fs", "autostack"]
# The generated-bindings surface (Diplomat): the single source of truth for every
# language binding (C/C++/JS/Kotlin/Python/PHP) under bindings/, generated from
# src/bridge/ by tools/gen-bindings.sh. Replaces the old hand-written ffi/wasm/
# python/php layers and their parity linters.
bridge = ["dep:diplomat", "dep:diplomat-runtime", "dep:base64", "autostack"]
# Everything the full generated surface needs at runtime; used for codegen builds,
# smoke tests, and release artifacts of the generated bindings.
bridge-full = [
    "bridge",
    "meshing",
    "rendering",
    "scripting-lua",
    "scripting-js",
    "voxelize",
]

# Storage backends (the `store` module). `mem` is always available; the rest
# are feature-gated so you only pull the deps you enable. Networked backends
# wrap async SDKs behind an internal `block_on` so the trait stays sync.
store-fs = []
store-s3 = ["dep:aws-sdk-s3", "dep:tokio", "dep:futures-util"]
store-redis = ["dep:redis", "dep:tokio"]
store-pg = ["dep:tokio-postgres", "dep:tokio"]
store-callback = []
# Exposes the backend-agnostic contract suite + testcontainers for integration tests.
store-testkit = ["dep:testcontainers-modules"]
serde = []
# Auto-stack: detect repeating structures + resize them (pure-voxel core)
autostack = []
# Mesh voxelization: GLB/OBJ models -> building Shapes + textured schematics
voxelize = ["dep:gltf", "dep:image"]
# Meshing support - generate 3D meshes from schematics
meshing = ["schematic-mesher"]
# GPU rendering support - render schematics to images
rendering = ["meshing", "dep:wgpu", "dep:image", "dep:pollster"]
# Embedded scripting engines
scripting-lua = ["mlua"]
scripting-js = ["rquickjs"]
scripting = ["scripting-lua", "scripting-js"]
# Data-refresh tooling for the vendored blockpedia module (tools/mc-data/):
# downloads the MC client jar / textures and regenerates the gzipped data
# snapshots in data/blockpedia/. Network + image deps live only here so
# normal builds never pay for them.
mc-data-refresh = ["dep:image", "dep:reqwest"]

[dependencies]
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
chrono = { version = "0.4", features = ["serde"] }
quartz_nbt = { version = "0.2.9", features = ["preserve_order"] }
flate2 = { version = "1.1.2", default-features = false, features = ["zlib-rs"] }
log = "0.4.22"
console = "0.15.8"
insign = "0.1.1"
# Vendored blockpedia module (src/blockpedia/) dependencies. The block tables
# are PHF maps generated by build.rs from data/blockpedia/*.json.gz.
phf = { version = "0.11", features = ["macros"] }
palette = "0.7"
anyhow = "1.0"

tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = "0.1.40"
thiserror = "1.0.63"
rayon = "1.10"
smol_str = { version = "0.2", features = ["serde"] }
rustc-hash = "2.0"

rand = "0.8.5"
# getrandom "custom": the Diplomat wasm module has no wasm-bindgen glue, so the "js"
# entropy source can't be used; lib.rs registers a non-crypto fallback on wasm32
# (rand here only feeds seeded shuffles and cosmetic jitter, never key material).
getrandom = { version = "0.2", features = ["custom"] }

# Diplomat bridge dependencies (base64: binary payloads cross DiplomatWrite as base64,
# since the JS/Kotlin backends decode the write buffer as UTF-8 text)
diplomat = { version = "0.15.0", optional = true }
diplomat-runtime = { version = "0.15.1", optional = true }
base64 = { version = "0.22", optional = true }

# Scripting engine dependencies
mlua = { version = "0.10", features = ["luajit", "vendored"], optional = true }
rquickjs = { version = "0.9", features = ["macro", "classes", "properties"], optional = true }

bincode = "1"
blake3 = "1"
ron = "0.8"
rustfft = "6"
bytemuck = { version = "1.23.1", features = ["derive"] }
zip = { version = "2", default-features = false, features = ["deflate"] }

# Storage backend dependencies - optional, behind store-* features.
# Networked backends use async SDKs wrapped with an internal tokio runtime.
tokio = { version = "1", features = ["rt-multi-thread", "net", "time"], optional = true }
aws-sdk-s3 = { version = "1", optional = true }
futures-util = { version = "0.3", optional = true }
redis = { version = "0.27", features = ["tokio-comp"], optional = true }
tokio-postgres = { version = "0.7", optional = true }
# Test-only (behind store-testkit): spin real backends in integration tests.
testcontainers-modules = { version = "0.11", features = [
    "minio",
    "redis",
    "postgres",
    "blocking",
], optional = true }

# Meshing dependencies - optional
# Dual version+git dep: the git side pins the exact rev the crates.io 0.1.0
# release was published from (253d2b6 + manifest-only packaging fixes; same
# source). cargo publish keeps the version and drops the git side, so the
# published nucleation crate keeps meshing/rendering.
schematic-mesher = { version = "0.2.0", git = "https://github.com/Schem-at/Schematic-Mesher.git", rev = "d22d39ca6b0664f97b14e059d411240932cd9d22", optional = true }

# Rendering dependencies - optional
wgpu = { version = "24", optional = true }
image = { version = "0.24", optional = true }
pollster = { version = "0.4", optional = true }

# Mesh voxelization (voxelize feature). gltf with default features off: we parse
# GLB containers ourselves (`Gltf::from_slice` + the `utils` accessor readers)
# and decode embedded png/jpeg textures with the `image` dep above, so gltf's
# own `import`/`image` machinery (and its separate image-crate version) stays out
# of the tree. NOTE: do not enable gltf's "names" feature — it toggles a `name`
# field onto every gltf-json struct crate-tree-wide and breaks schematic-mesher's
# struct literals (feature unification).
gltf = { version = "1.4", default-features = false, features = ["utils"], optional = true }

# Simulation (MCHPRS) dependencies - optional
# Note: These are git dependencies and will be excluded from crates.io publish
# Using Nano112's MCHPRS fork with custom IO support and bug fixes
# Networking is disabled to avoid WASM compatibility issues
# Rev 18c0c76: branch fix/torch-symmetry-non-cross-wires —
# preserves coalesced world positions on flush so mirror-image torches
# both update (in addition to existing custom IO + wire connectivity fixes)

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# mc-data-refresh tooling only (never in normal builds; see the feature note)
reqwest = { version = "0.12", features = ["blocking", "json"], optional = true }

[build-dependencies]
# build.rs gunzips data/blockpedia/*.json.gz and generates the PHF block
# tables for the vendored blockpedia module.
anyhow = "1.0"
serde_json = "1.0"
flate2 = { version = "1.1.2", default-features = false, features = ["zlib-rs"] }

# Data-refresh tools for the vendored blockpedia module. Run from the repo
# root; they rewrite data/blockpedia/*.json.gz (see README).
[[bin]]
name = "refresh-block-data"
path = "tools/mc-data/refresh-block-data.rs"
required-features = ["mc-data-refresh"]

[[bin]]
name = "fetch-texture-colors"
path = "tools/mc-data/fetch-texture-colors.rs"
required-features = ["mc-data-refresh"]

[[bin]]
name = "download-textures"
path = "tools/mc-data/download-textures.rs"
required-features = ["mc-data-refresh"]

[[bin]]
name = "refresh-bedrock-mappings"
path = "tools/mc-data/refresh-bedrock-mappings.rs"
required-features = ["mc-data-refresh"]

[dev-dependencies]
num-complex = "0.4"
base64 = "0.22"
ffmpeg-sidecar = "2.4"
winit = "0.30"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
criterion = "0.5.1"

[[bench]]
name = "block_placement"
harness = false

[[bench]]
name = "performance_test"
harness = false

[[bench]]
name = "region_bench"
harness = false

[[bench]]
name = "scripting_bench"
harness = false
required-features = ["scripting"]

[[bench]]
name = "snapshot_bench"
harness = false

[[bench]]
name = "fingerprint_bench"
harness = false

# Examples requiring the meshing feature
[[example]]
name = "render_schematic"
required-features = ["rendering"]

[[example]]
name = "bench_mesh_timing"
required-features = ["meshing"]

[[example]]
name = "compare_formats"
required-features = ["meshing"]

[[example]]
name = "gen_test_nucm"
required-features = ["meshing"]

[[example]]
name = "quick_mesh_test"
required-features = ["meshing"]

[[example]]
name = "nucm_size_test"
required-features = ["meshing"]

[[example]]
name = "convert_world"
required-features = ["meshing"]

[[example]]
name = "item_model_test"
required-features = ["meshing"]

[[example]]
name = "multi_item_model"
required-features = ["meshing"]

[[example]]
name = "entity_mesh_test"
required-features = ["meshing"]

# Store backends against real services via testcontainers (docker required).
[[test]]
name = "store_testcontainers"
required-features = ["store-s3", "store-redis", "store-pg", "store-testkit"]

[profile.bench]
debug = true

[profile.release]
lto = true
opt-level = 3