nucleation 0.3.18

A high-performance Minecraft schematic parser and utility library
Documentation
// src/lib.rs

// Core modules
// Vendored Minecraft block database (was the standalone `blockpedia` crate);
// block tables are generated by build.rs from data/blockpedia/*.json.gz.
pub mod blockpedia;

pub mod block_entity;
pub mod block_entity_store;
pub mod block_position;
mod block_state;
mod bounding_box;
pub mod building;
mod chunk;
pub mod dataconverter;
pub mod definition_region;
pub mod diff;
mod entity;
pub mod fingerprint;
pub mod formats;
pub mod geo;
pub mod insign;
mod item;
mod metadata;
pub mod nbt;
mod print_utils;
mod region;
pub mod schematic_builder;
pub mod sdf;
pub mod selection;
pub mod store;
pub mod store_io;
mod transforms;
mod universal_schematic;
pub mod utils;

// Feature-specific modules
#[cfg(feature = "autostack")]
pub mod autostack;
#[cfg(feature = "bridge")]
pub mod bridge;
#[cfg(feature = "meshing")]
pub mod meshing;
#[cfg(feature = "rendering")]
pub mod rendering;
#[cfg(any(feature = "scripting-lua", feature = "scripting-js"))]
pub mod scripting;
#[cfg(feature = "simulation")]
pub mod simulation;
#[cfg(feature = "voxelize")]
pub mod voxelize;

// The Diplomat wasm module carries no wasm-bindgen glue, so getrandom's "js" source is
// unavailable; register a deterministic splitmix64 stream instead. Non-crypto by design:
// rand only feeds seeded shuffles and cosmetic jitter here (see Cargo.toml note).
#[cfg(target_arch = "wasm32")]
mod wasm_entropy {
    use std::sync::atomic::{AtomicU64, Ordering};

    static STATE: AtomicU64 = AtomicU64::new(0x9E3779B97F4A7C15);

    pub fn getrandom_fallback(buf: &mut [u8]) -> Result<(), getrandom::Error> {
        for chunk in buf.chunks_mut(8) {
            let mut z = STATE.fetch_add(0x9E3779B97F4A7C15, Ordering::Relaxed);
            z = (z ^ (z >> 30)).wrapping_mul(0xBF58476D1CE4E5B9);
            z = (z ^ (z >> 27)).wrapping_mul(0x94D049BB133111EB);
            z ^= z >> 31;
            let bytes = z.to_le_bytes();
            chunk.copy_from_slice(&bytes[..chunk.len()]);
        }
        Ok(())
    }
}
#[cfg(target_arch = "wasm32")]
getrandom::register_custom_getrandom!(wasm_entropy::getrandom_fallback);

// Public re-exports
pub use block_state::BlockState;
pub use bounding_box::BoundingBox;
pub use entity::Entity;
pub use formats::{litematic, schematic, world_stream};
pub use print_utils::{format_json_schematic, format_schematic};
pub use region::Region;
pub use schematic_builder::{
    palettes, IoMarker, IoType as BuilderIoType, PaletteEntry, SchematicBuilder,
};
pub use selection::{
    connected_components, connected_components_collect, flood, AndMask, BlocklistMask, Component,
    Connectivity, Continue, Limits, Mask, NotAirMask, NotMask, OrMask, StopReason, VisitedSet,
};
pub use store::{MemStore, Store, StoreError};
pub use universal_schematic::UniversalSchematic;