nucleation 0.10.27 → 0.11.0

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/Schematic.d.mts CHANGED
@@ -221,6 +221,15 @@ export class Schematic {
221
221
  */
222
222
  setBlocks(positions: Array<number>, blockName: string): number;
223
223
 
224
+ /**
225
+ * Place many different blocks in one call: position `i` gets
226
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
227
+ * `indices` has one entry per position, and `palette_json` is a JSON
228
+ * array of block strings (properties and NBT allowed, `simulate` not).
229
+ * Returns the number of blocks set.
230
+ */
231
+ setBlocksIndexed(positions: Array<number>, indices: Array<number>, paletteJson: string): number;
232
+
224
233
  /**
225
234
  * Sequentially hand-place the same block at many positions in one
226
235
  * local simulated component. `positions` is flat
package/Schematic.d.ts CHANGED
@@ -221,6 +221,15 @@ export class Schematic {
221
221
  */
222
222
  setBlocks(positions: Array<number>, blockName: string): number;
223
223
 
224
+ /**
225
+ * Place many different blocks in one call: position `i` gets
226
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
227
+ * `indices` has one entry per position, and `palette_json` is a JSON
228
+ * array of block strings (properties and NBT allowed, `simulate` not).
229
+ * Returns the number of blocks set.
230
+ */
231
+ setBlocksIndexed(positions: Array<number>, indices: Array<number>, paletteJson: string): number;
232
+
224
233
  /**
225
234
  * Sequentially hand-place the same block at many positions in one
226
235
  * local simulated component. `positions` is flat
package/Schematic.mjs CHANGED
@@ -973,6 +973,40 @@ export class Schematic {
973
973
  }
974
974
  }
975
975
 
976
+ /**
977
+ * Place many different blocks in one call: position `i` gets
978
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
979
+ * `indices` has one entry per position, and `palette_json` is a JSON
980
+ * array of block strings (properties and NBT allowed, `simulate` not).
981
+ * Returns the number of blocks set.
982
+ */
983
+ setBlocksIndexed(positions, indices, paletteJson) {
984
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
985
+
986
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
987
+ const indicesSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, indices, "u32")));
988
+ const paletteJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, paletteJson)));
989
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
990
+
991
+
992
+ const result = wasm.Schematic_set_blocks_indexed(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, indicesSlice.ptr, paletteJsonSlice.ptr);
993
+
994
+ try {
995
+ if (!diplomatReceive.resultFlag) {
996
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
997
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
998
+ }
999
+ return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
1000
+ }
1001
+
1002
+ finally {
1003
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1004
+ functionCleanupArena.free();
1005
+
1006
+ diplomatReceive.free();
1007
+ }
1008
+ }
1009
+
976
1010
  /**
977
1011
  * Sequentially hand-place the same block at many positions in one
978
1012
  * local simulated component. `positions` is flat
package/nucleation.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleation",
3
- "version": "0.10.27",
3
+ "version": "0.11.0",
4
4
  "description": "A high-performance Minecraft schematic parser and utility library",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -221,6 +221,15 @@ export class Schematic {
221
221
  */
222
222
  setBlocks(positions: Array<number>, blockName: string): number;
223
223
 
224
+ /**
225
+ * Place many different blocks in one call: position `i` gets
226
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
227
+ * `indices` has one entry per position, and `palette_json` is a JSON
228
+ * array of block strings (properties and NBT allowed, `simulate` not).
229
+ * Returns the number of blocks set.
230
+ */
231
+ setBlocksIndexed(positions: Array<number>, indices: Array<number>, paletteJson: string): number;
232
+
224
233
  /**
225
234
  * Sequentially hand-place the same block at many positions in one
226
235
  * local simulated component. `positions` is flat
@@ -221,6 +221,15 @@ export class Schematic {
221
221
  */
222
222
  setBlocks(positions: Array<number>, blockName: string): number;
223
223
 
224
+ /**
225
+ * Place many different blocks in one call: position `i` gets
226
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
227
+ * `indices` has one entry per position, and `palette_json` is a JSON
228
+ * array of block strings (properties and NBT allowed, `simulate` not).
229
+ * Returns the number of blocks set.
230
+ */
231
+ setBlocksIndexed(positions: Array<number>, indices: Array<number>, paletteJson: string): number;
232
+
224
233
  /**
225
234
  * Sequentially hand-place the same block at many positions in one
226
235
  * local simulated component. `positions` is flat
@@ -973,6 +973,40 @@ export class Schematic {
973
973
  }
974
974
  }
975
975
 
976
+ /**
977
+ * Place many different blocks in one call: position `i` gets
978
+ * `palette[indices[i]]`. `positions` is flat `[x0,y0,z0, ...]`,
979
+ * `indices` has one entry per position, and `palette_json` is a JSON
980
+ * array of block strings (properties and NBT allowed, `simulate` not).
981
+ * Returns the number of blocks set.
982
+ */
983
+ setBlocksIndexed(positions, indices, paletteJson) {
984
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
985
+
986
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
987
+ const indicesSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, indices, "u32")));
988
+ const paletteJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, paletteJson)));
989
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
990
+
991
+
992
+ const result = wasm.Schematic_set_blocks_indexed(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, indicesSlice.ptr, paletteJsonSlice.ptr);
993
+
994
+ try {
995
+ if (!diplomatReceive.resultFlag) {
996
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
997
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
998
+ }
999
+ return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
1000
+ }
1001
+
1002
+ finally {
1003
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1004
+ functionCleanupArena.free();
1005
+
1006
+ diplomatReceive.free();
1007
+ }
1008
+ }
1009
+
976
1010
  /**
977
1011
  * Sequentially hand-place the same block at many positions in one
978
1012
  * local simulated component. `positions` is flat
Binary file