nucleation 0.1.68 → 0.1.71
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/nucleation-original.js +158 -0
- package/nucleation.d.ts +66 -8
- package/nucleation_bg.wasm +0 -0
- package/package.json +1 -1
package/nucleation-original.js
CHANGED
|
@@ -395,6 +395,71 @@ export class BlockStateWrapper {
|
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
+
const LazyChunkIteratorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
399
|
+
? { register: () => {}, unregister: () => {} }
|
|
400
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lazychunkiterator_free(ptr >>> 0, 1));
|
|
401
|
+
|
|
402
|
+
export class LazyChunkIterator {
|
|
403
|
+
|
|
404
|
+
static __wrap(ptr) {
|
|
405
|
+
ptr = ptr >>> 0;
|
|
406
|
+
const obj = Object.create(LazyChunkIterator.prototype);
|
|
407
|
+
obj.__wbg_ptr = ptr;
|
|
408
|
+
LazyChunkIteratorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
409
|
+
return obj;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
__destroy_into_raw() {
|
|
413
|
+
const ptr = this.__wbg_ptr;
|
|
414
|
+
this.__wbg_ptr = 0;
|
|
415
|
+
LazyChunkIteratorFinalization.unregister(this);
|
|
416
|
+
return ptr;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
free() {
|
|
420
|
+
const ptr = this.__destroy_into_raw();
|
|
421
|
+
wasm.__wbg_lazychunkiterator_free(ptr, 0);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get the next chunk on-demand (generates it fresh, doesn't store it)
|
|
425
|
+
* @returns {any}
|
|
426
|
+
*/
|
|
427
|
+
next() {
|
|
428
|
+
const ret = wasm.lazychunkiterator_next(this.__wbg_ptr);
|
|
429
|
+
return ret;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @returns {boolean}
|
|
433
|
+
*/
|
|
434
|
+
has_next() {
|
|
435
|
+
const ret = wasm.lazychunkiterator_has_next(this.__wbg_ptr);
|
|
436
|
+
return ret !== 0;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* @returns {number}
|
|
440
|
+
*/
|
|
441
|
+
total_chunks() {
|
|
442
|
+
const ret = wasm.lazychunkiterator_total_chunks(this.__wbg_ptr);
|
|
443
|
+
return ret >>> 0;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* @returns {number}
|
|
447
|
+
*/
|
|
448
|
+
current_position() {
|
|
449
|
+
const ret = wasm.lazychunkiterator_current_position(this.__wbg_ptr);
|
|
450
|
+
return ret >>> 0;
|
|
451
|
+
}
|
|
452
|
+
reset() {
|
|
453
|
+
wasm.lazychunkiterator_reset(this.__wbg_ptr);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @param {number} index
|
|
457
|
+
*/
|
|
458
|
+
skip_to(index) {
|
|
459
|
+
wasm.lazychunkiterator_skip_to(this.__wbg_ptr, index);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
398
463
|
const SchematicWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
399
464
|
? { register: () => {}, unregister: () => {} }
|
|
400
465
|
: new FinalizationRegistry(ptr => wasm.__wbg_schematicwrapper_free(ptr >>> 0, 1));
|
|
@@ -504,6 +569,13 @@ export class SchematicWrapper {
|
|
|
504
569
|
const ret = wasm.schematicwrapper_get_palette(this.__wbg_ptr);
|
|
505
570
|
return ret;
|
|
506
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* @returns {any}
|
|
574
|
+
*/
|
|
575
|
+
get_default_region_palette() {
|
|
576
|
+
const ret = wasm.schematicwrapper_get_default_region_palette(this.__wbg_ptr);
|
|
577
|
+
return ret;
|
|
578
|
+
}
|
|
507
579
|
/**
|
|
508
580
|
* @param {string} region_name
|
|
509
581
|
* @returns {any}
|
|
@@ -727,6 +799,92 @@ export class SchematicWrapper {
|
|
|
727
799
|
const ret = wasm.schematicwrapper_get_chunk_blocks(this.__wbg_ptr, offset_x, offset_y, offset_z, width, height, length);
|
|
728
800
|
return ret;
|
|
729
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* Get all palettes once - eliminates repeated string transfers
|
|
804
|
+
* Returns: { default: [BlockState], regions: { regionName: [BlockState] } }
|
|
805
|
+
* @returns {any}
|
|
806
|
+
*/
|
|
807
|
+
get_all_palettes() {
|
|
808
|
+
const ret = wasm.schematicwrapper_get_all_palettes(this.__wbg_ptr);
|
|
809
|
+
return ret;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Optimized chunks iterator that returns palette indices instead of full block data
|
|
813
|
+
* Returns array of: { chunk_x, chunk_y, chunk_z, blocks: [[x,y,z,palette_index],...] }
|
|
814
|
+
* @param {number} chunk_width
|
|
815
|
+
* @param {number} chunk_height
|
|
816
|
+
* @param {number} chunk_length
|
|
817
|
+
* @returns {Array<any>}
|
|
818
|
+
*/
|
|
819
|
+
chunks_indices(chunk_width, chunk_height, chunk_length) {
|
|
820
|
+
const ret = wasm.schematicwrapper_chunks_indices(this.__wbg_ptr, chunk_width, chunk_height, chunk_length);
|
|
821
|
+
return ret;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Optimized chunks with strategy - returns palette indices
|
|
825
|
+
* @param {number} chunk_width
|
|
826
|
+
* @param {number} chunk_height
|
|
827
|
+
* @param {number} chunk_length
|
|
828
|
+
* @param {string} strategy
|
|
829
|
+
* @param {number} camera_x
|
|
830
|
+
* @param {number} camera_y
|
|
831
|
+
* @param {number} camera_z
|
|
832
|
+
* @returns {Array<any>}
|
|
833
|
+
*/
|
|
834
|
+
chunks_indices_with_strategy(chunk_width, chunk_height, chunk_length, strategy, camera_x, camera_y, camera_z) {
|
|
835
|
+
const ptr0 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
836
|
+
const len0 = WASM_VECTOR_LEN;
|
|
837
|
+
const ret = wasm.schematicwrapper_chunks_indices_with_strategy(this.__wbg_ptr, chunk_width, chunk_height, chunk_length, ptr0, len0, camera_x, camera_y, camera_z);
|
|
838
|
+
return ret;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get specific chunk blocks as palette indices (for lazy loading individual chunks)
|
|
842
|
+
* Returns array of [x, y, z, palette_index]
|
|
843
|
+
* @param {number} offset_x
|
|
844
|
+
* @param {number} offset_y
|
|
845
|
+
* @param {number} offset_z
|
|
846
|
+
* @param {number} width
|
|
847
|
+
* @param {number} height
|
|
848
|
+
* @param {number} length
|
|
849
|
+
* @returns {Array<any>}
|
|
850
|
+
*/
|
|
851
|
+
get_chunk_blocks_indices(offset_x, offset_y, offset_z, width, height, length) {
|
|
852
|
+
const ret = wasm.schematicwrapper_get_chunk_blocks_indices(this.__wbg_ptr, offset_x, offset_y, offset_z, width, height, length);
|
|
853
|
+
return ret;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* All blocks as palette indices - for when you need everything at once but efficiently
|
|
857
|
+
* Returns array of [x, y, z, palette_index]
|
|
858
|
+
* @returns {Array<any>}
|
|
859
|
+
*/
|
|
860
|
+
blocks_indices() {
|
|
861
|
+
const ret = wasm.schematicwrapper_blocks_indices(this.__wbg_ptr);
|
|
862
|
+
return ret;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Get optimization stats
|
|
866
|
+
* @returns {any}
|
|
867
|
+
*/
|
|
868
|
+
get_optimization_info() {
|
|
869
|
+
const ret = wasm.schematicwrapper_get_optimization_info(this.__wbg_ptr);
|
|
870
|
+
return ret;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* @param {number} chunk_width
|
|
874
|
+
* @param {number} chunk_height
|
|
875
|
+
* @param {number} chunk_length
|
|
876
|
+
* @param {string} strategy
|
|
877
|
+
* @param {number} camera_x
|
|
878
|
+
* @param {number} camera_y
|
|
879
|
+
* @param {number} camera_z
|
|
880
|
+
* @returns {LazyChunkIterator}
|
|
881
|
+
*/
|
|
882
|
+
create_lazy_chunk_iterator(chunk_width, chunk_height, chunk_length, strategy, camera_x, camera_y, camera_z) {
|
|
883
|
+
const ptr0 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
884
|
+
const len0 = WASM_VECTOR_LEN;
|
|
885
|
+
const ret = wasm.schematicwrapper_create_lazy_chunk_iterator(this.__wbg_ptr, chunk_width, chunk_height, chunk_length, ptr0, len0, camera_x, camera_y, camera_z);
|
|
886
|
+
return LazyChunkIterator.__wrap(ret);
|
|
887
|
+
}
|
|
730
888
|
}
|
|
731
889
|
|
|
732
890
|
async function __wbg_load(module, imports) {
|
package/nucleation.d.ts
CHANGED
|
@@ -17,6 +17,19 @@ export class BlockStateWrapper {
|
|
|
17
17
|
name(): string;
|
|
18
18
|
properties(): any;
|
|
19
19
|
}
|
|
20
|
+
export class LazyChunkIterator {
|
|
21
|
+
private constructor();
|
|
22
|
+
free(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the next chunk on-demand (generates it fresh, doesn't store it)
|
|
25
|
+
*/
|
|
26
|
+
next(): any;
|
|
27
|
+
has_next(): boolean;
|
|
28
|
+
total_chunks(): number;
|
|
29
|
+
current_position(): number;
|
|
30
|
+
reset(): void;
|
|
31
|
+
skip_to(index: number): void;
|
|
32
|
+
}
|
|
20
33
|
export class SchematicWrapper {
|
|
21
34
|
free(): void;
|
|
22
35
|
constructor();
|
|
@@ -28,6 +41,7 @@ export class SchematicWrapper {
|
|
|
28
41
|
to_schematic_version(version: string): Uint8Array;
|
|
29
42
|
get_available_schematic_versions(): Array<any>;
|
|
30
43
|
get_palette(): any;
|
|
44
|
+
get_default_region_palette(): any;
|
|
31
45
|
get_palette_from_region(region_name: string): any;
|
|
32
46
|
get_bounding_box(): any;
|
|
33
47
|
get_region_bounding_box(region_name: string): any;
|
|
@@ -48,20 +62,42 @@ export class SchematicWrapper {
|
|
|
48
62
|
chunks(chunk_width: number, chunk_height: number, chunk_length: number): Array<any>;
|
|
49
63
|
chunks_with_strategy(chunk_width: number, chunk_height: number, chunk_length: number, strategy: string, camera_x: number, camera_y: number, camera_z: number): Array<any>;
|
|
50
64
|
get_chunk_blocks(offset_x: number, offset_y: number, offset_z: number, width: number, height: number, length: number): Array<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Get all palettes once - eliminates repeated string transfers
|
|
67
|
+
* Returns: { default: [BlockState], regions: { regionName: [BlockState] } }
|
|
68
|
+
*/
|
|
69
|
+
get_all_palettes(): any;
|
|
70
|
+
/**
|
|
71
|
+
* Optimized chunks iterator that returns palette indices instead of full block data
|
|
72
|
+
* Returns array of: { chunk_x, chunk_y, chunk_z, blocks: [[x,y,z,palette_index],...] }
|
|
73
|
+
*/
|
|
74
|
+
chunks_indices(chunk_width: number, chunk_height: number, chunk_length: number): Array<any>;
|
|
75
|
+
/**
|
|
76
|
+
* Optimized chunks with strategy - returns palette indices
|
|
77
|
+
*/
|
|
78
|
+
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>;
|
|
79
|
+
/**
|
|
80
|
+
* Get specific chunk blocks as palette indices (for lazy loading individual chunks)
|
|
81
|
+
* Returns array of [x, y, z, palette_index]
|
|
82
|
+
*/
|
|
83
|
+
get_chunk_blocks_indices(offset_x: number, offset_y: number, offset_z: number, width: number, height: number, length: number): Array<any>;
|
|
84
|
+
/**
|
|
85
|
+
* All blocks as palette indices - for when you need everything at once but efficiently
|
|
86
|
+
* Returns array of [x, y, z, palette_index]
|
|
87
|
+
*/
|
|
88
|
+
blocks_indices(): Array<any>;
|
|
89
|
+
/**
|
|
90
|
+
* Get optimization stats
|
|
91
|
+
*/
|
|
92
|
+
get_optimization_info(): any;
|
|
93
|
+
create_lazy_chunk_iterator(chunk_width: number, chunk_height: number, chunk_length: number, strategy: string, camera_x: number, camera_y: number, camera_z: number): LazyChunkIterator;
|
|
51
94
|
}
|
|
52
95
|
|
|
53
96
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
54
97
|
|
|
55
98
|
export interface InitOutput {
|
|
56
99
|
readonly memory: WebAssembly.Memory;
|
|
57
|
-
readonly
|
|
58
|
-
readonly __wbg_get_blockposition_x: (a: number) => number;
|
|
59
|
-
readonly __wbg_set_blockposition_x: (a: number, b: number) => void;
|
|
60
|
-
readonly __wbg_get_blockposition_y: (a: number) => number;
|
|
61
|
-
readonly __wbg_set_blockposition_y: (a: number, b: number) => void;
|
|
62
|
-
readonly __wbg_get_blockposition_z: (a: number) => number;
|
|
63
|
-
readonly __wbg_set_blockposition_z: (a: number, b: number) => void;
|
|
64
|
-
readonly blockposition_new: (a: number, b: number, c: number) => number;
|
|
100
|
+
readonly __wbg_lazychunkiterator_free: (a: number, b: number) => void;
|
|
65
101
|
readonly __wbg_schematicwrapper_free: (a: number, b: number) => void;
|
|
66
102
|
readonly __wbg_blockstatewrapper_free: (a: number, b: number) => void;
|
|
67
103
|
readonly schematicwrapper_new: () => number;
|
|
@@ -73,6 +109,7 @@ export interface InitOutput {
|
|
|
73
109
|
readonly schematicwrapper_to_schematic_version: (a: number, b: number, c: number) => [number, number, number, number];
|
|
74
110
|
readonly schematicwrapper_get_available_schematic_versions: (a: number) => any;
|
|
75
111
|
readonly schematicwrapper_get_palette: (a: number) => any;
|
|
112
|
+
readonly schematicwrapper_get_default_region_palette: (a: number) => any;
|
|
76
113
|
readonly schematicwrapper_get_palette_from_region: (a: number, b: number, c: number) => any;
|
|
77
114
|
readonly schematicwrapper_get_bounding_box: (a: number) => any;
|
|
78
115
|
readonly schematicwrapper_get_region_bounding_box: (a: number, b: number, c: number) => any;
|
|
@@ -93,6 +130,19 @@ export interface InitOutput {
|
|
|
93
130
|
readonly schematicwrapper_chunks: (a: number, b: number, c: number, d: number) => any;
|
|
94
131
|
readonly schematicwrapper_chunks_with_strategy: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
|
|
95
132
|
readonly schematicwrapper_get_chunk_blocks: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
133
|
+
readonly schematicwrapper_get_all_palettes: (a: number) => any;
|
|
134
|
+
readonly schematicwrapper_chunks_indices: (a: number, b: number, c: number, d: number) => any;
|
|
135
|
+
readonly schematicwrapper_chunks_indices_with_strategy: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
|
|
136
|
+
readonly schematicwrapper_get_chunk_blocks_indices: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
137
|
+
readonly schematicwrapper_blocks_indices: (a: number) => any;
|
|
138
|
+
readonly schematicwrapper_get_optimization_info: (a: number) => any;
|
|
139
|
+
readonly schematicwrapper_create_lazy_chunk_iterator: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
140
|
+
readonly lazychunkiterator_next: (a: number) => any;
|
|
141
|
+
readonly lazychunkiterator_has_next: (a: number) => number;
|
|
142
|
+
readonly lazychunkiterator_total_chunks: (a: number) => number;
|
|
143
|
+
readonly lazychunkiterator_current_position: (a: number) => number;
|
|
144
|
+
readonly lazychunkiterator_reset: (a: number) => void;
|
|
145
|
+
readonly lazychunkiterator_skip_to: (a: number, b: number) => void;
|
|
96
146
|
readonly blockstatewrapper_new: (a: number, b: number) => number;
|
|
97
147
|
readonly blockstatewrapper_with_property: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
98
148
|
readonly blockstatewrapper_name: (a: number) => [number, number];
|
|
@@ -100,6 +150,14 @@ export interface InitOutput {
|
|
|
100
150
|
readonly debug_schematic: (a: number) => [number, number];
|
|
101
151
|
readonly debug_json_schematic: (a: number) => [number, number];
|
|
102
152
|
readonly start: () => void;
|
|
153
|
+
readonly __wbg_blockposition_free: (a: number, b: number) => void;
|
|
154
|
+
readonly __wbg_get_blockposition_x: (a: number) => number;
|
|
155
|
+
readonly __wbg_set_blockposition_x: (a: number, b: number) => void;
|
|
156
|
+
readonly __wbg_get_blockposition_y: (a: number) => number;
|
|
157
|
+
readonly __wbg_set_blockposition_y: (a: number, b: number) => void;
|
|
158
|
+
readonly __wbg_get_blockposition_z: (a: number) => number;
|
|
159
|
+
readonly __wbg_set_blockposition_z: (a: number, b: number) => void;
|
|
160
|
+
readonly blockposition_new: (a: number, b: number, c: number) => number;
|
|
103
161
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
104
162
|
readonly __externref_table_alloc: () => number;
|
|
105
163
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/nucleation_bg.wasm
CHANGED
|
Binary file
|