nucleation 0.1.20 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,142 +1,169 @@
1
- # Nucleation
1
+ # 🧬 Nucleation
2
2
 
3
- Nucleation is a high-performance Minecraft schematic parser and utility library written in Rust, with WebAssembly and FFI bindings for multiple environments.
3
+ **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**.
4
4
 
5
- [//]: # ([![Crates.io](https://img.shields.io/crates/v/nucleation.svg)](https://crates.io/crates/nucleation))
5
+ > Built for performance, portability, and parity across ecosystems.
6
6
 
7
- [//]: # ([![NPM Version](https://img.shields.io/npm/v/nucleation.svg)](https://www.npmjs.com/package/nucleation))
7
+ ---
8
8
 
9
- [//]: # ([![MIT/Apache-2.0](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE))
9
+ [![Crates.io](https://img.shields.io/crates/v/nucleation.svg)](https://crates.io/crates/nucleation)
10
+ [![npm](https://img.shields.io/npm/v/nucleation.svg)](https://www.npmjs.com/package/nucleation)
11
+ [![PyPI](https://img.shields.io/pypi/v/nucleation.svg)](https://pypi.org/project/nucleation)
10
12
 
11
- ## Features
13
+ ---
12
14
 
13
- - Parse and manipulate multiple schematic formats (.schematic, .litematic, etc.)
14
- - High-performance Rust core with WebAssembly bindings
15
- - Chunk-based loading for progressive rendering
16
- - Block entity support (chests, signs, etc.)
17
- - Designed for integration with [Cubane](https://github.com/Nano112/cubane) for 3D visualization
15
+ ## Features
18
16
 
19
- ## Installation
17
+ - ✅ Multi-format support: `.schematic`, `.litematic`, `.nbt`, etc.
18
+ - 🧠 Memory-safe Rust core with zero-copy deserialization
19
+ - 🌐 WASM module for browser + Node.js
20
+ - 🐍 Native Python bindings (`pip install nucleation`)
21
+ - ⚙️ C-compatible FFI for PHP, C, Go, etc.
22
+ - 🔄 Feature parity across all interfaces
23
+ - 📦 Binary builds for Linux, macOS, Windows (x86_64 + ARM64)
24
+ - 🧱 Seamless integration with [Cubane](https://github.com/Nano112/cubane)
20
25
 
21
- ### Rust
26
+ ---
27
+
28
+ ## 📦 Installation
29
+
30
+ ### 🔧 Rust
22
31
 
23
32
  ```bash
24
33
  cargo add nucleation
25
- ```
34
+ ````
26
35
 
27
- ### JavaScript/TypeScript (via npm)
36
+ ### 🌐 JavaScript / TypeScript (WASM)
28
37
 
29
38
  ```bash
30
39
  npm install nucleation
31
- # or
32
- yarn add nucleation
33
40
  ```
34
41
 
35
- ## Usage Examples
42
+ ### 🐍 Python
36
43
 
37
- ### JavaScript (WebAssembly)
44
+ ```bash
45
+ pip install nucleation
46
+ ```
38
47
 
39
- ```javascript
40
- import { SchematicParser } from 'nucleation';
48
+ ### 🧩 C / PHP / FFI
41
49
 
42
- // Load a schematic file
43
- const response = await fetch('example.litematic');
44
- const fileData = new Uint8Array(await response.arrayBuffer());
50
+ Download prebuilt `.so` / `.dylib` / `.dll` from [Releases](https://github.com/Schem-at/Nucleation/releases)
51
+ or build locally using:
45
52
 
46
- // Parse the schematic
47
- const parser = new SchematicParser();
48
- await parser.fromData(fileData);
49
-
50
- // Get schematic dimensions
51
- const [width, height, depth] = parser.getDimensions();
52
- console.log(`Dimensions: ${width}x${height}x${depth}`);
53
-
54
- // Load blocks progressively in chunks
55
- const chunks = parser.chunksWithStrategy(
56
- 16, 16, 16, // chunk size
57
- "distance_to_camera", // loading strategy
58
- camera.x, camera.y, camera.z
59
- );
60
-
61
- // With Cubane integration
62
- const renderer = new Cubane.Cubane();
63
- for (const chunk of chunks) {
64
- for (const block of chunk.blocks) {
65
- const mesh = await renderer.getBlockMesh(block.name);
66
- mesh.position.set(block.x, block.y, block.z);
67
- scene.add(mesh);
68
- }
69
- }
53
+ ```bash
54
+ ./build-ffi.sh
70
55
  ```
71
56
 
57
+ ---
58
+
59
+ ## 🚀 Quick Examples
60
+
72
61
  ### Rust
73
62
 
74
63
  ```rust
75
- use nucleation::SchematicParser;
76
-
77
- fn main() -> Result<(), Box<dyn std::error::Error>> {
78
- // Load a schematic file
79
- let data = std::fs::read("example.litematic")?;
80
-
81
- // Parse the schematic
82
- let parser = SchematicParser::new();
83
- let schematic = parser.from_data(&data)?;
84
-
85
- // Get block information
86
- let dimensions = schematic.get_dimensions();
87
- println!("Dimensions: {}x{}x{}", dimensions[0], dimensions[1], dimensions[2]);
88
-
89
- // Iterate through blocks
90
- for (pos, block) in schematic.iter_blocks() {
91
- println!("Block at {},{},{}: {}", pos.x, pos.y, pos.z, block.name);
92
- }
93
-
94
- Ok(())
95
- }
64
+ use nucleation::UniversalSchematic;
65
+
66
+ let bytes = std::fs::read("example.litematic")?;
67
+ let mut schematic = UniversalSchematic::new("my_schematic");
68
+ schematic.load_from_data(&bytes)?;
69
+ println!("{:?}", schematic.get_info());
96
70
  ```
97
71
 
98
- ## Integration with Cubane
72
+ 📖 [More in `examples/rust.md`](examples/rust.md)
99
73
 
100
- Nucleation works seamlessly with [Cubane](https://github.com/Nano112/cubane) for 3D visualization, forming a complete solution for Minecraft schematic processing and rendering.
74
+ ---
75
+
76
+ ### JavaScript (WASM)
101
77
 
102
- ```javascript
103
- import { SchematicParser } from 'nucleation';
104
- import { Cubane } from 'cubane';
78
+ ```ts
79
+ import { SchematicParser } from "nucleation";
105
80
 
106
- // Parse schematic with Nucleation
81
+ const bytes = await fetch("example.litematic").then(r => r.arrayBuffer());
107
82
  const parser = new SchematicParser();
108
- await parser.fromData(fileData);
109
-
110
- // Render with Cubane
111
- const cubane = new Cubane.Cubane();
112
- // ... set up Three.js scene ...
113
-
114
- // Load and render blocks
115
- for (const block of parser.blocks()) {
116
- const mesh = await cubane.getBlockMesh(block.name);
117
- mesh.position.set(block.x, block.y, block.z);
118
- scene.add(mesh);
119
- }
83
+ await parser.fromData(new Uint8Array(bytes));
84
+
85
+ console.log(parser.getDimensions());
86
+ ```
87
+
88
+ 📖 → [More in `examples/wasm.md`](examples/wasm.md)
89
+
90
+ ---
91
+
92
+ ### Python
93
+
94
+ ```python
95
+ from nucleation import Schematic
96
+
97
+ with open("example.litematic", "rb") as f:
98
+ data = f.read()
99
+
100
+ schem = Schematic("my_schematic")
101
+ schem.load_from_bytes(data)
102
+
103
+ print(schem.get_info())
120
104
  ```
121
105
 
122
- ## License
106
+ 📖 → [More in `examples/python.md`](examples/python.md)
107
+
108
+ ---
109
+
110
+ ### FFI (PHP/C)
123
111
 
124
- This project is available under the MIT or Apache-2.0 license.
112
+ ```c
113
+ #include "nucleation.h"
125
114
 
115
+ SchematicHandle* handle = schematic_new("MySchem");
116
+ schematic_load_data(handle, data_ptr, data_len);
117
+
118
+ CSchematicInfo info;
119
+ schematic_get_info(handle, &info);
120
+ printf("Size: %dx%dx%d\n", info.width, info.height, info.depth);
121
+
122
+ schematic_free(handle);
123
+ ```
124
+
125
+ 📖 → [More in `examples/ffi.md`](examples/ffi.md)
126
+
127
+ ---
126
128
 
127
- ## Development
129
+ ## 🔧 Development
128
130
 
129
131
  ```bash
130
- # Build the Rust library
132
+ # Build the Rust core
131
133
  cargo build --release
132
134
 
133
- # Build the WebAssembly package
135
+ # Build WASM module
134
136
  ./build-wasm.sh
135
137
 
136
- # Run tests
137
- cargo test
138
+ # Build Python bindings locally
139
+ maturin develop --features python
140
+
141
+ # Build FFI libs
142
+ ./build-ffi.sh
138
143
  ```
139
144
 
140
145
  ---
141
146
 
142
- Created and maintained by [Nano](https://github.com/Nano112)
147
+ ## 📚 Submodules & Bindings
148
+
149
+ ### Rust
150
+ * [`examples/rust.md`](examples/rust.md)
151
+
152
+ ### JavaScript/TypeScript
153
+ * [`examples/wasm.md`](examples/wasm.md)
154
+
155
+ ### Python
156
+ * [`examples/python.md`](examples/python.md)
157
+
158
+ ### FFI (C/PHP)
159
+ * [`examples/ffi.md`](examples/ffi.md)
160
+
161
+ ---
162
+
163
+ ## ⚖️ License
164
+
165
+ Licensed under the **GNU AGPL-3.0-only**.
166
+ See [`LICENSE`](./LICENSE) for full terms.
167
+
168
+
169
+ Made by [@Nano112](https://github.com/Nano112) with ❤️
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Nano nano@schem.at"
6
6
  ],
7
7
  "description": "A high-performance Minecraft schematic parser and utility library",
8
- "version": "0.1.20",
8
+ "version": "0.1.25",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",
@@ -29,8 +29,6 @@
29
29
  "minecraft",
30
30
  "schematic",
31
31
  "parser",
32
- "wasm",
33
- "webassembly",
34
32
  "voxel"
35
33
  ],
36
34
  "module": "./nucleation.js",
@@ -44,6 +42,6 @@
44
42
  },
45
43
  "./package.json": "./package.json"
46
44
  },
47
- "author": "Nano <nano@schem.at>",
48
- "homepage": "https://github.com/Schem-at/Nucleation"
45
+ "homepage": "https://github.com/Schem-at/Nucleation",
46
+ "author": "Nano <nano@schem.at>"
49
47
  }