nucleation 0.1.75 → 0.1.78

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.
@@ -243,6 +243,10 @@ export function debug_schematic(schematic) {
243
243
  }
244
244
  }
245
245
 
246
+ export function start() {
247
+ wasm.start();
248
+ }
249
+
246
250
  /**
247
251
  * @param {SchematicWrapper} schematic
248
252
  * @returns {string}
@@ -261,10 +265,6 @@ export function debug_json_schematic(schematic) {
261
265
  }
262
266
  }
263
267
 
264
- export function start() {
265
- wasm.start();
266
- }
267
-
268
268
  const BlockPositionFinalization = (typeof FinalizationRegistry === 'undefined')
269
269
  ? { register: () => {}, unregister: () => {} }
270
270
  : new FinalizationRegistry(ptr => wasm.__wbg_blockposition_free(ptr >>> 0, 1));
@@ -507,6 +507,21 @@ export class MchprsWorldWrapper {
507
507
  on_use_block(x, y, z) {
508
508
  wasm.mchprsworldwrapper_on_use_block(this.__wbg_ptr, x, y, z);
509
509
  }
510
+ /**
511
+ * Creates a simulation world with custom options
512
+ * @param {SchematicWrapper} schematic
513
+ * @param {SimulationOptionsWrapper} options
514
+ * @returns {MchprsWorldWrapper}
515
+ */
516
+ static with_options(schematic, options) {
517
+ _assertClass(schematic, SchematicWrapper);
518
+ _assertClass(options, SimulationOptionsWrapper);
519
+ const ret = wasm.mchprsworldwrapper_with_options(schematic.__wbg_ptr, options.__wbg_ptr);
520
+ if (ret[2]) {
521
+ throw takeFromExternrefTable0(ret[1]);
522
+ }
523
+ return MchprsWorldWrapper.__wrap(ret[0]);
524
+ }
510
525
  /**
511
526
  * Gets a copy of the underlying schematic
512
527
  *
@@ -799,6 +814,22 @@ export class SchematicWrapper {
799
814
  const ret = wasm.schematicwrapper_get_block_entity(this.__wbg_ptr, x, y, z);
800
815
  return ret;
801
816
  }
817
+ /**
818
+ * Get block as formatted string with properties (e.g., "minecraft:lever[powered=true,facing=north]")
819
+ * @param {number} x
820
+ * @param {number} y
821
+ * @param {number} z
822
+ * @returns {string | undefined}
823
+ */
824
+ get_block_string(x, y, z) {
825
+ const ret = wasm.schematicwrapper_get_block_string(this.__wbg_ptr, x, y, z);
826
+ let v1;
827
+ if (ret[0] !== 0) {
828
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
829
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
830
+ }
831
+ return v1;
832
+ }
802
833
  /**
803
834
  * @returns {any}
804
835
  */
@@ -875,7 +906,7 @@ export class SchematicWrapper {
875
906
  return ret;
876
907
  }
877
908
  /**
878
- * Creates a simulation world for this schematic
909
+ * Creates a simulation world for this schematic with default options
879
910
  *
880
911
  * This allows you to simulate redstone circuits and interact with them.
881
912
  * @returns {MchprsWorldWrapper}
@@ -994,6 +1025,21 @@ export class SchematicWrapper {
994
1025
  const ret = wasm.schematicwrapper_get_available_schematic_versions(this.__wbg_ptr);
995
1026
  return ret;
996
1027
  }
1028
+ /**
1029
+ * Creates a simulation world for this schematic with custom options
1030
+ *
1031
+ * This allows you to configure simulation behavior like wire state tracking.
1032
+ * @param {SimulationOptionsWrapper} options
1033
+ * @returns {MchprsWorldWrapper}
1034
+ */
1035
+ create_simulation_world_with_options(options) {
1036
+ _assertClass(options, SimulationOptionsWrapper);
1037
+ const ret = wasm.schematicwrapper_create_simulation_world_with_options(this.__wbg_ptr, options.__wbg_ptr);
1038
+ if (ret[2]) {
1039
+ throw takeFromExternrefTable0(ret[1]);
1040
+ }
1041
+ return MchprsWorldWrapper.__wrap(ret[0]);
1042
+ }
997
1043
  constructor() {
998
1044
  const ret = wasm.schematicwrapper_new();
999
1045
  this.__wbg_ptr = ret >>> 0;
@@ -1057,6 +1103,58 @@ export class SchematicWrapper {
1057
1103
  }
1058
1104
  if (Symbol.dispose) SchematicWrapper.prototype[Symbol.dispose] = SchematicWrapper.prototype.free;
1059
1105
 
1106
+ const SimulationOptionsWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
1107
+ ? { register: () => {}, unregister: () => {} }
1108
+ : new FinalizationRegistry(ptr => wasm.__wbg_simulationoptionswrapper_free(ptr >>> 0, 1));
1109
+
1110
+ export class SimulationOptionsWrapper {
1111
+
1112
+ __destroy_into_raw() {
1113
+ const ptr = this.__wbg_ptr;
1114
+ this.__wbg_ptr = 0;
1115
+ SimulationOptionsWrapperFinalization.unregister(this);
1116
+ return ptr;
1117
+ }
1118
+
1119
+ free() {
1120
+ const ptr = this.__destroy_into_raw();
1121
+ wasm.__wbg_simulationoptionswrapper_free(ptr, 0);
1122
+ }
1123
+ /**
1124
+ * @param {boolean} value
1125
+ */
1126
+ set io_only(value) {
1127
+ wasm.simulationoptionswrapper_set_io_only(this.__wbg_ptr, value);
1128
+ }
1129
+ /**
1130
+ * @param {boolean} value
1131
+ */
1132
+ set optimize(value) {
1133
+ wasm.simulationoptionswrapper_set_optimize(this.__wbg_ptr, value);
1134
+ }
1135
+ constructor() {
1136
+ const ret = wasm.simulationoptionswrapper_new();
1137
+ this.__wbg_ptr = ret >>> 0;
1138
+ SimulationOptionsWrapperFinalization.register(this, this.__wbg_ptr, this);
1139
+ return this;
1140
+ }
1141
+ /**
1142
+ * @returns {boolean}
1143
+ */
1144
+ get io_only() {
1145
+ const ret = wasm.simulationoptionswrapper_io_only(this.__wbg_ptr);
1146
+ return ret !== 0;
1147
+ }
1148
+ /**
1149
+ * @returns {boolean}
1150
+ */
1151
+ get optimize() {
1152
+ const ret = wasm.simulationoptionswrapper_optimize(this.__wbg_ptr);
1153
+ return ret !== 0;
1154
+ }
1155
+ }
1156
+ if (Symbol.dispose) SimulationOptionsWrapper.prototype[Symbol.dispose] = SimulationOptionsWrapper.prototype.free;
1157
+
1060
1158
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1061
1159
 
1062
1160
  async function __wbg_load(module, imports) {
package/nucleation.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function debug_schematic(schematic: SchematicWrapper): string;
4
- export function debug_json_schematic(schematic: SchematicWrapper): string;
5
4
  export function start(): void;
5
+ export function debug_json_schematic(schematic: SchematicWrapper): string;
6
6
  export class BlockPosition {
7
7
  free(): void;
8
8
  [Symbol.dispose](): void;
@@ -40,6 +40,10 @@ export class MchprsWorldWrapper {
40
40
  * Simulates a right-click on a block (typically a lever)
41
41
  */
42
42
  on_use_block(x: number, y: number, z: number): void;
43
+ /**
44
+ * Creates a simulation world with custom options
45
+ */
46
+ static with_options(schematic: SchematicWrapper, options: SimulationOptionsWrapper): MchprsWorldWrapper;
43
47
  /**
44
48
  * Gets a copy of the underlying schematic
45
49
  *
@@ -116,6 +120,10 @@ export class SchematicWrapper {
116
120
  */
117
121
  get_all_palettes(): any;
118
122
  get_block_entity(x: number, y: number, z: number): any;
123
+ /**
124
+ * Get block as formatted string with properties (e.g., "minecraft:lever[powered=true,facing=north]")
125
+ */
126
+ get_block_string(x: number, y: number, z: number): string | undefined;
119
127
  get_bounding_box(): any;
120
128
  get_chunk_blocks(offset_x: number, offset_y: number, offset_z: number, width: number, height: number, length: number): Array<any>;
121
129
  get_region_names(): string[];
@@ -127,7 +135,7 @@ export class SchematicWrapper {
127
135
  get_optimization_info(): any;
128
136
  get_all_block_entities(): any;
129
137
  /**
130
- * Creates a simulation world for this schematic
138
+ * Creates a simulation world for this schematic with default options
131
139
  *
132
140
  * This allows you to simulate redstone circuits and interact with them.
133
141
  */
@@ -148,6 +156,12 @@ export class SchematicWrapper {
148
156
  */
149
157
  chunks_indices_with_strategy(chunk_width: number, chunk_height: number, chunk_length: number, strategy: string, camera_x: number, camera_y: number, camera_z: number): Array<any>;
150
158
  get_available_schematic_versions(): Array<any>;
159
+ /**
160
+ * Creates a simulation world for this schematic with custom options
161
+ *
162
+ * This allows you to configure simulation behavior like wire state tracking.
163
+ */
164
+ create_simulation_world_with_options(options: SimulationOptionsWrapper): MchprsWorldWrapper;
151
165
  constructor();
152
166
  blocks(): Array<any>;
153
167
  chunks(chunk_width: number, chunk_height: number, chunk_length: number): Array<any>;
@@ -155,15 +169,31 @@ export class SchematicWrapper {
155
169
  get_block(x: number, y: number, z: number): string | undefined;
156
170
  set_block(x: number, y: number, z: number, block_name: string): void;
157
171
  }
172
+ export class SimulationOptionsWrapper {
173
+ free(): void;
174
+ [Symbol.dispose](): void;
175
+ constructor();
176
+ io_only: boolean;
177
+ optimize: boolean;
178
+ }
158
179
 
159
180
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
160
181
 
161
182
  export interface InitOutput {
162
183
  readonly memory: WebAssembly.Memory;
184
+ readonly __wbg_blockposition_free: (a: number, b: number) => void;
185
+ readonly __wbg_get_blockposition_x: (a: number) => number;
186
+ readonly __wbg_get_blockposition_y: (a: number) => number;
187
+ readonly __wbg_get_blockposition_z: (a: number) => number;
188
+ readonly __wbg_set_blockposition_x: (a: number, b: number) => void;
189
+ readonly __wbg_set_blockposition_y: (a: number, b: number) => void;
190
+ readonly __wbg_set_blockposition_z: (a: number, b: number) => void;
191
+ readonly blockposition_new: (a: number, b: number, c: number) => number;
163
192
  readonly __wbg_blockstatewrapper_free: (a: number, b: number) => void;
164
193
  readonly __wbg_lazychunkiterator_free: (a: number, b: number) => void;
165
194
  readonly __wbg_mchprsworldwrapper_free: (a: number, b: number) => void;
166
195
  readonly __wbg_schematicwrapper_free: (a: number, b: number) => void;
196
+ readonly __wbg_simulationoptionswrapper_free: (a: number, b: number) => void;
167
197
  readonly blockstatewrapper_name: (a: number) => [number, number];
168
198
  readonly blockstatewrapper_new: (a: number, b: number) => number;
169
199
  readonly blockstatewrapper_properties: (a: number) => any;
@@ -187,6 +217,7 @@ export interface InitOutput {
187
217
  readonly mchprsworldwrapper_on_use_block: (a: number, b: number, c: number, d: number) => void;
188
218
  readonly mchprsworldwrapper_sync_to_schematic: (a: number) => void;
189
219
  readonly mchprsworldwrapper_tick: (a: number, b: number) => void;
220
+ readonly mchprsworldwrapper_with_options: (a: number, b: number) => [number, number, number];
190
221
  readonly schematicwrapper_blocks: (a: number) => any;
191
222
  readonly schematicwrapper_blocks_indices: (a: number) => any;
192
223
  readonly schematicwrapper_chunks: (a: number, b: number, c: number, d: number) => any;
@@ -205,6 +236,7 @@ export interface InitOutput {
205
236
  readonly schematicwrapper_get_block: (a: number, b: number, c: number, d: number) => [number, number];
206
237
  readonly schematicwrapper_get_block_count: (a: number) => number;
207
238
  readonly schematicwrapper_get_block_entity: (a: number, b: number, c: number, d: number) => any;
239
+ readonly schematicwrapper_get_block_string: (a: number, b: number, c: number, d: number) => [number, number];
208
240
  readonly schematicwrapper_get_block_with_properties: (a: number, b: number, c: number, d: number) => number;
209
241
  readonly schematicwrapper_get_bounding_box: (a: number) => any;
210
242
  readonly schematicwrapper_get_chunk_blocks: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
@@ -224,16 +256,14 @@ export interface InitOutput {
224
256
  readonly schematicwrapper_to_litematic: (a: number) => [number, number, number, number];
225
257
  readonly schematicwrapper_to_schematic: (a: number) => [number, number, number, number];
226
258
  readonly schematicwrapper_to_schematic_version: (a: number, b: number, c: number) => [number, number, number, number];
259
+ readonly simulationoptionswrapper_io_only: (a: number) => number;
260
+ readonly simulationoptionswrapper_new: () => number;
261
+ readonly simulationoptionswrapper_optimize: (a: number) => number;
262
+ readonly simulationoptionswrapper_set_io_only: (a: number, b: number) => void;
263
+ readonly simulationoptionswrapper_set_optimize: (a: number, b: number) => void;
264
+ readonly schematicwrapper_create_simulation_world_with_options: (a: number, b: number) => [number, number, number];
227
265
  readonly schematicwrapper_create_simulation_world: (a: number) => [number, number, number];
228
266
  readonly start: () => void;
229
- readonly __wbg_blockposition_free: (a: number, b: number) => void;
230
- readonly __wbg_get_blockposition_x: (a: number) => number;
231
- readonly __wbg_get_blockposition_y: (a: number) => number;
232
- readonly __wbg_get_blockposition_z: (a: number) => number;
233
- readonly __wbg_set_blockposition_x: (a: number, b: number) => void;
234
- readonly __wbg_set_blockposition_y: (a: number, b: number) => void;
235
- readonly __wbg_set_blockposition_z: (a: number, b: number) => void;
236
- readonly blockposition_new: (a: number, b: number, c: number) => number;
237
267
  readonly __wbindgen_malloc: (a: number, b: number) => number;
238
268
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
239
269
  readonly __wbindgen_exn_store: (a: number) => void;
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.75",
8
+ "version": "0.1.78",
9
9
  "license": "AGPL-3.0-only",
10
10
  "repository": {
11
11
  "type": "git",