nucleation 0.1.58

A high-performance Minecraft schematic parser and utility library
Documentation

๐Ÿงฌ Nucleation

Nucleation is a high-performance Minecraft schematic engine written in Rust โ€” with full support for Rust, WebAssembly/JavaScript, Python, and FFI-based integrations like PHP and C.

Built for performance, portability, and parity across ecosystems.


Crates.io npm PyPI CI/CD


โœจ Features

  • โœ… Multi-format support: .schematic, .litematic, .nbt, etc.
  • ๐Ÿง  Memory-safe Rust core with zero-copy deserialization
  • ๐ŸŒ WASM module for browser + Node.js with TypeScript support
  • ๐Ÿ Native Python bindings (pip install nucleation)
  • โš™๏ธ C-compatible FFI for PHP, C, Go, etc.
  • ๐ŸŽจ Blockpedia integration for color analysis and block transformations (native targets)
  • ๐Ÿ”„ Feature parity across all interfaces via single API definition
  • ๐Ÿ“ฆ Binary builds for Linux, macOS, Windows (x86_64 + ARM64)
  • ๐Ÿš€ Automatic binding generation from centralized API definitions
  • ๐Ÿงช Comprehensive test suite with CI/CD pipeline

๐Ÿ“ฆ Installation

๐Ÿ”ง Rust

cargo add nucleation

๐ŸŒ JavaScript / TypeScript (WASM)

npm install nucleation

๐Ÿ Python

pip install nucleation

๐Ÿงฉ C / PHP / FFI

Download prebuilt .so / .dylib / .dll from Releases or build locally using:

./build-ffi.sh

๐Ÿš€ Quick Examples

Rust

use nucleation::UniversalSchematic;

let bytes = std::fs::read("example.litematic")?;
let mut schematic = UniversalSchematic::new("my_schematic");
schematic.load_from_data(&bytes)?;
println!("{:?}", schematic.get_info());

๐Ÿ“– โ†’ Documentation | Complete Code Example


JavaScript (WASM)

import { SchematicParser } from "nucleation";

const bytes = await fetch("example.litematic").then(r => r.arrayBuffer());
const parser = new SchematicParser();
await parser.fromData(new Uint8Array(bytes));

console.log(parser.getDimensions());

๐Ÿ“– โ†’ Documentation | Complete Code Example


Python

from nucleation import Schematic

with open("example.litematic", "rb") as f:
    data = f.read()

schem = Schematic("my_schematic")
schem.load_from_bytes(data)

print(schem.get_info())

๐Ÿ“– โ†’ Documentation | Complete Code Example


FFI (PHP/C)

#include "nucleation.h"

SchematicHandle* handle = schematic_new("MySchem");
schematic_load_data(handle, data_ptr, data_len);

CSchematicInfo info;
schematic_get_info(handle, &info);
printf("Size: %dx%dx%d\n", info.width, info.height, info.depth);

schematic_free(handle);

๐Ÿ“– โ†’ Documentation | Complete Code Example


๐Ÿ”ง Development

Building

# Build the Rust core
cargo build --release

# Build WASM module with target support
cargo build --target wasm32-unknown-unknown --features wasm
./build-wasm.sh

# Build Python bindings locally
maturin develop --features python

# Build FFI libs
./build-ffi.sh

๐Ÿค– Automated Binding Generation

Nucleation uses a single source of truth approach for all bindings. The API is defined once in src/api_definition.rs and automatically translated to all supported languages:

# Generate all binding files from API definition
cargo run --bin generate-bindings

# Check if bindings are up to date
cargo run --bin generate-bindings check

# Generate API documentation report
cargo run --bin generate-bindings report

This generates:

  • WASM: TypeScript definitions and JavaScript bindings
  • Python: PyO3 bindings and .pyi type stubs
  • FFI: C header files and Rust FFI implementations

๐Ÿงช Testing

# Run all tests
cargo test

# Test specific targets
cargo test --features wasm --test wasm_tests        # WASM tests
cargo test --test python_tests                      # Python tests
cargo test --test blockpedia_integration_test       # Blockpedia tests (non-WASM only)

# Test WASM build specifically
cargo build --target wasm32-unknown-unknown --features wasm

Note: WASM builds exclude blockpedia features for compatibility. Color analysis and block transformations are available only on native targets.

Version Management

Versions are centrally managed in version.toml. Use the Makefile commands:

# Check version consistency across all files
make version-check

# Bump versions automatically
make version-bump-patch    # 0.1.0 โ†’ 0.1.1
make version-bump-minor    # 0.1.0 โ†’ 0.2.0  
make version-bump-major    # 0.1.0 โ†’ 1.0.0

# Update all files from version.toml
make version-update

๐Ÿ“– โ†’ Full Version Management Guide


๐Ÿ“š Submodules & Bindings

๐Ÿ“„ Documentation & Examples

Each binding includes comprehensive documentation and working code examples:

Language API Documentation Working Example Type Definitions
Rust examples/rust.md examples/rust_example.rs Native Rust docs
JavaScript/WASM examples/wasm.md examples/wasm_example.js pkg/nucleation.d.ts
Python examples/python.md examples/python_example.py python-stubs/nucleation.pyi
C/FFI examples/ffi.md examples/ffi_example.c include/nucleation.h

โš–๏ธ License

Licensed under the GNU AGPL-3.0-only. See LICENSE for full terms.

Made by @Nano112 with โค๏ธ