nucleation 0.3.14 → 0.3.16

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.
@@ -39,6 +39,18 @@ export class WorldChunkView {
39
39
  */
40
40
  toSchematic(): Schematic;
41
41
 
42
+ /**
43
+ * Build a chunk view at (`cx`, `cz`) from a schematic — every non-air
44
+ * block whose world (x, z) falls in this chunk is copied in, the rest
45
+ * ignored. The write-side twin of `to_schematic`: this is how the
46
+ * schematic building tools become a *world generator*. Fill a schematic
47
+ * with any shape, SDF, brush, or footprint (intersect it with the
48
+ * chunk's cuboid to keep memory flat), then hand it here per chunk and
49
+ * `WorldSink.write_chunk` it. Also the transform step of a world filter:
50
+ * `to_schematic` a streamed chunk, edit it, rebuild with this.
51
+ */
52
+ static fromSchematic(schematic: Schematic, cx: number, cz: number): WorldChunkView;
53
+
42
54
  /**
43
55
  * Set a block at absolute world coordinates inside this chunk view.
44
56
  * `block_name` must be a valid Minecraft block identifier (e.g.
@@ -108,6 +108,29 @@ export class WorldChunkView {
108
108
  }
109
109
  }
110
110
 
111
+ /**
112
+ * Build a chunk view at (`cx`, `cz`) from a schematic — every non-air
113
+ * block whose world (x, z) falls in this chunk is copied in, the rest
114
+ * ignored. The write-side twin of `to_schematic`: this is how the
115
+ * schematic building tools become a *world generator*. Fill a schematic
116
+ * with any shape, SDF, brush, or footprint (intersect it with the
117
+ * chunk's cuboid to keep memory flat), then hand it here per chunk and
118
+ * `WorldSink.write_chunk` it. Also the transform step of a world filter:
119
+ * `to_schematic` a streamed chunk, edit it, rebuild with this.
120
+ */
121
+ static fromSchematic(schematic, cx, cz) {
122
+
123
+ const result = wasm.WorldChunkView_from_schematic(schematic.ffiValue, cx, cz);
124
+
125
+ try {
126
+ return new WorldChunkView(diplomatRuntime.internalConstructor, result, []);
127
+ }
128
+
129
+ finally {
130
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
131
+ }
132
+ }
133
+
111
134
  /**
112
135
  * Set a block at absolute world coordinates inside this chunk view.
113
136
  * `block_name` must be a valid Minecraft block identifier (e.g.
package/nucleation.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleation",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "A high-performance Minecraft schematic parser and utility library",
5
5
  "type": "module",
6
6
  "main": "index.mjs",