nucleation 0.2.13 → 0.2.15
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/LICENSE +21 -661
- package/README.md +26 -1
- package/nucleation-original.js +788 -53
- package/nucleation.d.ts +462 -181
- package/nucleation_bg.wasm +0 -0
- package/package.json +2 -2
package/nucleation-original.js
CHANGED
|
@@ -373,6 +373,10 @@ const RawMeshExportWrapperFinalization = (typeof FinalizationRegistry === 'undef
|
|
|
373
373
|
? { register: () => {}, unregister: () => {} }
|
|
374
374
|
: new FinalizationRegistry(ptr => wasm.__wbg_rawmeshexportwrapper_free(ptr >>> 0, 1));
|
|
375
375
|
|
|
376
|
+
const RedstoneGraphWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
377
|
+
? { register: () => {}, unregister: () => {} }
|
|
378
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_redstonegraphwrapper_free(ptr >>> 0, 1));
|
|
379
|
+
|
|
376
380
|
const ResourcePackWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
377
381
|
? { register: () => {}, unregister: () => {} }
|
|
378
382
|
: new FinalizationRegistry(ptr => wasm.__wbg_resourcepackwrapper_free(ptr >>> 0, 1));
|
|
@@ -421,6 +425,18 @@ const WasmBuildingToolFinalization = (typeof FinalizationRegistry === 'undefined
|
|
|
421
425
|
? { register: () => {}, unregister: () => {} }
|
|
422
426
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmbuildingtool_free(ptr >>> 0, 1));
|
|
423
427
|
|
|
428
|
+
const WorldChunkIterWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
429
|
+
? { register: () => {}, unregister: () => {} }
|
|
430
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_worldchunkiterwrapper_free(ptr >>> 0, 1));
|
|
431
|
+
|
|
432
|
+
const WorldChunkViewWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
433
|
+
? { register: () => {}, unregister: () => {} }
|
|
434
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_worldchunkviewwrapper_free(ptr >>> 0, 1));
|
|
435
|
+
|
|
436
|
+
const WorldSourceWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
437
|
+
? { register: () => {}, unregister: () => {} }
|
|
438
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_worldsourcewrapper_free(ptr >>> 0, 1));
|
|
439
|
+
|
|
424
440
|
export class BlockPosition {
|
|
425
441
|
__destroy_into_raw() {
|
|
426
442
|
const ptr = this.__wbg_ptr;
|
|
@@ -1766,7 +1782,7 @@ export class DiffWrapper {
|
|
|
1766
1782
|
/**
|
|
1767
1783
|
* Connected change regions as a JSON array.
|
|
1768
1784
|
*
|
|
1769
|
-
* Each region: `{min:[x,y,z], max:[x,y,z], kind:"added|removed|changed|mixed", count}`.
|
|
1785
|
+
* Each region: `{min:[x,y,z], max:[x,y,z], kind:"added|removed|changed|swapped|mixed", count}`.
|
|
1770
1786
|
* @returns {string}
|
|
1771
1787
|
*/
|
|
1772
1788
|
regionsJson() {
|
|
@@ -1877,11 +1893,14 @@ export class DiffWrapper {
|
|
|
1877
1893
|
}
|
|
1878
1894
|
/**
|
|
1879
1895
|
* Total edit distance (sum of weighted add/delete/change/swap costs).
|
|
1896
|
+
*
|
|
1897
|
+
* Surfaced as a JS `number` (f64). Edit distances stay well within f64's
|
|
1898
|
+
* exact-integer range; the core value is `u64`.
|
|
1880
1899
|
* @returns {number}
|
|
1881
1900
|
*/
|
|
1882
1901
|
get distance() {
|
|
1883
1902
|
const ret = wasm.diffwrapper_distance(this.__wbg_ptr);
|
|
1884
|
-
return ret
|
|
1903
|
+
return ret;
|
|
1885
1904
|
}
|
|
1886
1905
|
/**
|
|
1887
1906
|
* Reconstruct a diff from a JSON string produced by `toJson()`.
|
|
@@ -2830,6 +2849,17 @@ export class MchprsWorldWrapper {
|
|
|
2830
2849
|
const ptr = this.__destroy_into_raw();
|
|
2831
2850
|
wasm.__wbg_mchprsworldwrapper_free(ptr, 0);
|
|
2832
2851
|
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Extract the compiled redstone logic graph for this world.
|
|
2854
|
+
* @returns {RedstoneGraphWrapper}
|
|
2855
|
+
*/
|
|
2856
|
+
exportGraph() {
|
|
2857
|
+
const ret = wasm.mchprsworldwrapper_exportGraph(this.__wbg_ptr);
|
|
2858
|
+
if (ret[2]) {
|
|
2859
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2860
|
+
}
|
|
2861
|
+
return RedstoneGraphWrapper.__wrap(ret[0]);
|
|
2862
|
+
}
|
|
2833
2863
|
/**
|
|
2834
2864
|
* Simulates a right-click on a block (typically a lever)
|
|
2835
2865
|
* @param {number} x
|
|
@@ -2966,6 +2996,17 @@ export class MchprsWorldWrapper {
|
|
|
2966
2996
|
clearCustomIoChanges() {
|
|
2967
2997
|
wasm.mchprsworldwrapper_clearCustomIoChanges(this.__wbg_ptr);
|
|
2968
2998
|
}
|
|
2999
|
+
/**
|
|
3000
|
+
* Extract the structural (pre-fold, as-built) redstone logic graph.
|
|
3001
|
+
* @returns {RedstoneGraphWrapper}
|
|
3002
|
+
*/
|
|
3003
|
+
exportGraphStructural() {
|
|
3004
|
+
const ret = wasm.mchprsworldwrapper_exportGraphStructural(this.__wbg_ptr);
|
|
3005
|
+
if (ret[2]) {
|
|
3006
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3007
|
+
}
|
|
3008
|
+
return RedstoneGraphWrapper.__wrap(ret[0]);
|
|
3009
|
+
}
|
|
2969
3010
|
/**
|
|
2970
3011
|
* @param {SchematicWrapper} schematic
|
|
2971
3012
|
*/
|
|
@@ -3755,6 +3796,164 @@ export class RawMeshExportWrapper {
|
|
|
3755
3796
|
}
|
|
3756
3797
|
if (Symbol.dispose) RawMeshExportWrapper.prototype[Symbol.dispose] = RawMeshExportWrapper.prototype.free;
|
|
3757
3798
|
|
|
3799
|
+
/**
|
|
3800
|
+
* A wrapper around an extracted [`RedstoneGraph`] for JS consumers.
|
|
3801
|
+
*/
|
|
3802
|
+
export class RedstoneGraphWrapper {
|
|
3803
|
+
static __wrap(ptr) {
|
|
3804
|
+
ptr = ptr >>> 0;
|
|
3805
|
+
const obj = Object.create(RedstoneGraphWrapper.prototype);
|
|
3806
|
+
obj.__wbg_ptr = ptr;
|
|
3807
|
+
RedstoneGraphWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3808
|
+
return obj;
|
|
3809
|
+
}
|
|
3810
|
+
__destroy_into_raw() {
|
|
3811
|
+
const ptr = this.__wbg_ptr;
|
|
3812
|
+
this.__wbg_ptr = 0;
|
|
3813
|
+
RedstoneGraphWrapperFinalization.unregister(this);
|
|
3814
|
+
return ptr;
|
|
3815
|
+
}
|
|
3816
|
+
free() {
|
|
3817
|
+
const ptr = this.__destroy_into_raw();
|
|
3818
|
+
wasm.__wbg_redstonegraphwrapper_free(ptr, 0);
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* Total number of directed edges in the graph.
|
|
3822
|
+
* @returns {number}
|
|
3823
|
+
*/
|
|
3824
|
+
get edgeCount() {
|
|
3825
|
+
const ret = wasm.redstonegraphwrapper_edgeCount(this.__wbg_ptr);
|
|
3826
|
+
return ret >>> 0;
|
|
3827
|
+
}
|
|
3828
|
+
/**
|
|
3829
|
+
* Number of nodes in the graph.
|
|
3830
|
+
* @returns {number}
|
|
3831
|
+
*/
|
|
3832
|
+
get nodeCount() {
|
|
3833
|
+
const ret = wasm.redstonegraphwrapper_nodeCount(this.__wbg_ptr);
|
|
3834
|
+
return ret >>> 0;
|
|
3835
|
+
}
|
|
3836
|
+
/**
|
|
3837
|
+
* Compute the structural/functional/exact fingerprint as a hex string.
|
|
3838
|
+
*
|
|
3839
|
+
* `preset` defaults to `"structural"`; throws for an unknown preset.
|
|
3840
|
+
* @param {string | null} [preset]
|
|
3841
|
+
* @returns {string}
|
|
3842
|
+
*/
|
|
3843
|
+
fingerprint(preset) {
|
|
3844
|
+
let deferred3_0;
|
|
3845
|
+
let deferred3_1;
|
|
3846
|
+
try {
|
|
3847
|
+
var ptr0 = isLikeNone(preset) ? 0 : passStringToWasm0(preset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3848
|
+
var len0 = WASM_VECTOR_LEN;
|
|
3849
|
+
const ret = wasm.redstonegraphwrapper_fingerprint(this.__wbg_ptr, ptr0, len0);
|
|
3850
|
+
var ptr2 = ret[0];
|
|
3851
|
+
var len2 = ret[1];
|
|
3852
|
+
if (ret[3]) {
|
|
3853
|
+
ptr2 = 0; len2 = 0;
|
|
3854
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3855
|
+
}
|
|
3856
|
+
deferred3_0 = ptr2;
|
|
3857
|
+
deferred3_1 = len2;
|
|
3858
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3859
|
+
} finally {
|
|
3860
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
/**
|
|
3864
|
+
* The computed graph features serialized as a JSON string.
|
|
3865
|
+
* @returns {string}
|
|
3866
|
+
*/
|
|
3867
|
+
featuresJson() {
|
|
3868
|
+
let deferred2_0;
|
|
3869
|
+
let deferred2_1;
|
|
3870
|
+
try {
|
|
3871
|
+
const ret = wasm.redstonegraphwrapper_featuresJson(this.__wbg_ptr);
|
|
3872
|
+
var ptr1 = ret[0];
|
|
3873
|
+
var len1 = ret[1];
|
|
3874
|
+
if (ret[3]) {
|
|
3875
|
+
ptr1 = 0; len1 = 0;
|
|
3876
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3877
|
+
}
|
|
3878
|
+
deferred2_0 = ptr1;
|
|
3879
|
+
deferred2_1 = len1;
|
|
3880
|
+
return getStringFromWasm0(ptr1, len1);
|
|
3881
|
+
} finally {
|
|
3882
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* The directed edges as an array of `{source, target, kind, strength}`.
|
|
3887
|
+
* @returns {any}
|
|
3888
|
+
*/
|
|
3889
|
+
get edges() {
|
|
3890
|
+
const ret = wasm.redstonegraphwrapper_edges(this.__wbg_ptr);
|
|
3891
|
+
if (ret[2]) {
|
|
3892
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3893
|
+
}
|
|
3894
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* The nodes as an array of plain objects (kind-specific fields inlined).
|
|
3898
|
+
* @returns {any}
|
|
3899
|
+
*/
|
|
3900
|
+
get nodes() {
|
|
3901
|
+
const ret = wasm.redstonegraphwrapper_nodes(this.__wbg_ptr);
|
|
3902
|
+
if (ret[2]) {
|
|
3903
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3904
|
+
}
|
|
3905
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3906
|
+
}
|
|
3907
|
+
/**
|
|
3908
|
+
* Serialize the graph to JSON.
|
|
3909
|
+
* @returns {string}
|
|
3910
|
+
*/
|
|
3911
|
+
toJson() {
|
|
3912
|
+
let deferred2_0;
|
|
3913
|
+
let deferred2_1;
|
|
3914
|
+
try {
|
|
3915
|
+
const ret = wasm.redstonegraphwrapper_toJson(this.__wbg_ptr);
|
|
3916
|
+
var ptr1 = ret[0];
|
|
3917
|
+
var len1 = ret[1];
|
|
3918
|
+
if (ret[3]) {
|
|
3919
|
+
ptr1 = 0; len1 = 0;
|
|
3920
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3921
|
+
}
|
|
3922
|
+
deferred2_0 = ptr1;
|
|
3923
|
+
deferred2_1 = len1;
|
|
3924
|
+
return getStringFromWasm0(ptr1, len1);
|
|
3925
|
+
} finally {
|
|
3926
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* Computed graph features as a plain object.
|
|
3931
|
+
* @returns {any}
|
|
3932
|
+
*/
|
|
3933
|
+
features() {
|
|
3934
|
+
const ret = wasm.redstonegraphwrapper_features(this.__wbg_ptr);
|
|
3935
|
+
if (ret[2]) {
|
|
3936
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3937
|
+
}
|
|
3938
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* Deserialize a graph from JSON.
|
|
3942
|
+
* @param {string} s
|
|
3943
|
+
* @returns {RedstoneGraphWrapper}
|
|
3944
|
+
*/
|
|
3945
|
+
static fromJson(s) {
|
|
3946
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3947
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3948
|
+
const ret = wasm.redstonegraphwrapper_fromJson(ptr0, len0);
|
|
3949
|
+
if (ret[2]) {
|
|
3950
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3951
|
+
}
|
|
3952
|
+
return RedstoneGraphWrapper.__wrap(ret[0]);
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
if (Symbol.dispose) RedstoneGraphWrapper.prototype[Symbol.dispose] = RedstoneGraphWrapper.prototype.free;
|
|
3956
|
+
|
|
3758
3957
|
/**
|
|
3759
3958
|
* Wrapper for a Minecraft resource pack.
|
|
3760
3959
|
*/
|
|
@@ -4301,6 +4500,55 @@ export class SchematicWrapper {
|
|
|
4301
4500
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
4302
4501
|
}
|
|
4303
4502
|
}
|
|
4503
|
+
/**
|
|
4504
|
+
* Structurally diff this schematic against `other`.
|
|
4505
|
+
*
|
|
4506
|
+
* `preset` defaults to `"exact"`. `options` is an optional object
|
|
4507
|
+
* `{cost_add?, cost_delete?, cost_change?, cost_swap?, swap_dominance_pct?,
|
|
4508
|
+
* symmetry?}`. Returns a [`DiffWrapper`]. Unknown preset/symmetry → Err.
|
|
4509
|
+
* @param {SchematicWrapper} other
|
|
4510
|
+
* @param {string | null | undefined} preset
|
|
4511
|
+
* @param {any} options
|
|
4512
|
+
* @returns {DiffWrapper}
|
|
4513
|
+
*/
|
|
4514
|
+
diff(other, preset, options) {
|
|
4515
|
+
_assertClass(other, SchematicWrapper);
|
|
4516
|
+
var ptr0 = isLikeNone(preset) ? 0 : passStringToWasm0(preset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4517
|
+
var len0 = WASM_VECTOR_LEN;
|
|
4518
|
+
const ret = wasm.schematicwrapper_diff(this.__wbg_ptr, other.__wbg_ptr, ptr0, len0, options);
|
|
4519
|
+
if (ret[2]) {
|
|
4520
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4521
|
+
}
|
|
4522
|
+
return DiffWrapper.__wrap(ret[0]);
|
|
4523
|
+
}
|
|
4524
|
+
/**
|
|
4525
|
+
* Creates a simulation world for this schematic with default options
|
|
4526
|
+
*
|
|
4527
|
+
* This allows you to simulate redstone circuits and interact with them.
|
|
4528
|
+
* @returns {MchprsWorldWrapper}
|
|
4529
|
+
*/
|
|
4530
|
+
create_simulation_world() {
|
|
4531
|
+
const ret = wasm.schematicwrapper_create_simulation_world(this.__wbg_ptr);
|
|
4532
|
+
if (ret[2]) {
|
|
4533
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4534
|
+
}
|
|
4535
|
+
return MchprsWorldWrapper.__wrap(ret[0]);
|
|
4536
|
+
}
|
|
4537
|
+
/**
|
|
4538
|
+
* Creates a simulation world for this schematic with custom options
|
|
4539
|
+
*
|
|
4540
|
+
* This allows you to configure simulation behavior like wire state tracking.
|
|
4541
|
+
* @param {SimulationOptionsWrapper} options
|
|
4542
|
+
* @returns {MchprsWorldWrapper}
|
|
4543
|
+
*/
|
|
4544
|
+
create_simulation_world_with_options(options) {
|
|
4545
|
+
_assertClass(options, SimulationOptionsWrapper);
|
|
4546
|
+
const ret = wasm.schematicwrapper_create_simulation_world_with_options(this.__wbg_ptr, options.__wbg_ptr);
|
|
4547
|
+
if (ret[2]) {
|
|
4548
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4549
|
+
}
|
|
4550
|
+
return MchprsWorldWrapper.__wrap(ret[0]);
|
|
4551
|
+
}
|
|
4304
4552
|
/**
|
|
4305
4553
|
* Add a mobile entity to the schematic.
|
|
4306
4554
|
* @param {string} id
|
|
@@ -4960,6 +5208,11 @@ export class SchematicWrapper {
|
|
|
4960
5208
|
return ret;
|
|
4961
5209
|
}
|
|
4962
5210
|
/**
|
|
5211
|
+
* Get the structured block entity at a position as `{id, position, nbt}`,
|
|
5212
|
+
* or NULL if there is none. Returns *every* block-entity type (chests,
|
|
5213
|
+
* signs, furnaces, banners, spawners, …) — not just chests — so the editor
|
|
5214
|
+
* can read all the NBT nucleation preserves. (For a precision-faithful
|
|
5215
|
+
* representation of `Long`/`LongArray` fields, see `getBlockEntitySnbt`.)
|
|
4963
5216
|
* @param {number} x
|
|
4964
5217
|
* @param {number} y
|
|
4965
5218
|
* @param {number} z
|
|
@@ -5014,6 +5267,69 @@ export class SchematicWrapper {
|
|
|
5014
5267
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
5015
5268
|
return v1;
|
|
5016
5269
|
}
|
|
5270
|
+
/**
|
|
5271
|
+
* Set (or replace) a block entity at a position from an SNBT string. This is
|
|
5272
|
+
* the faithful, fully-typed write path the editor uses to persist
|
|
5273
|
+
* container contents, sign text, banner patterns, item components, etc.
|
|
5274
|
+
* SNBT preserves every NBT tag type with no precision loss.
|
|
5275
|
+
* @param {number} x
|
|
5276
|
+
* @param {number} y
|
|
5277
|
+
* @param {number} z
|
|
5278
|
+
* @param {string} id
|
|
5279
|
+
* @param {string} snbt
|
|
5280
|
+
*/
|
|
5281
|
+
setBlockEntity(x, y, z, id, snbt) {
|
|
5282
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5283
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5284
|
+
const ptr1 = passStringToWasm0(snbt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5285
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5286
|
+
const ret = wasm.schematicwrapper_setBlockEntity(this.__wbg_ptr, x, y, z, ptr0, len0, ptr1, len1);
|
|
5287
|
+
if (ret[1]) {
|
|
5288
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5291
|
+
/**
|
|
5292
|
+
* Detect repeating structures (by region coverage). Returns an array of
|
|
5293
|
+
* objects: `{ mode, vectors, coverage, region_min, region_max, cell_min,
|
|
5294
|
+
* cell_max, label }`.
|
|
5295
|
+
* @returns {any}
|
|
5296
|
+
*/
|
|
5297
|
+
detectStructures() {
|
|
5298
|
+
const ret = wasm.schematicwrapper_detectStructures(this.__wbg_ptr);
|
|
5299
|
+
return ret;
|
|
5300
|
+
}
|
|
5301
|
+
/**
|
|
5302
|
+
* Faithful, precision-safe read of every mobile entity as an SNBT string
|
|
5303
|
+
* (the full entity compound incl. `id`/`Pos`, typed). Mirrors
|
|
5304
|
+
* `getBlockEntitySnbt` so the editor can carry entity NBT verbatim.
|
|
5305
|
+
* @returns {Array<any>}
|
|
5306
|
+
*/
|
|
5307
|
+
getEntitiesSnbt() {
|
|
5308
|
+
const ret = wasm.schematicwrapper_getEntitiesSnbt(this.__wbg_ptr);
|
|
5309
|
+
return ret;
|
|
5310
|
+
}
|
|
5311
|
+
/**
|
|
5312
|
+
* Convert to `target_data_version` using the schematic's *captured* source
|
|
5313
|
+
* version (`source_data_version`, else `mc_version`, else canonical) as the
|
|
5314
|
+
* origin, updating the metadata version to the target. Returns the JSON loss
|
|
5315
|
+
* report (empty `[]` when lossless). This is the ergonomic save/load entry:
|
|
5316
|
+
* `convertToVersion(CANONICAL)` on load, `convertToVersion(target)` before
|
|
5317
|
+
* exporting for an older version.
|
|
5318
|
+
* @param {number} target_data_version
|
|
5319
|
+
* @returns {string}
|
|
5320
|
+
*/
|
|
5321
|
+
convertToVersion(target_data_version) {
|
|
5322
|
+
let deferred1_0;
|
|
5323
|
+
let deferred1_1;
|
|
5324
|
+
try {
|
|
5325
|
+
const ret = wasm.schematicwrapper_convertToVersion(this.__wbg_ptr, target_data_version);
|
|
5326
|
+
deferred1_0 = ret[0];
|
|
5327
|
+
deferred1_1 = ret[1];
|
|
5328
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5329
|
+
} finally {
|
|
5330
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5017
5333
|
/**
|
|
5018
5334
|
* @param {number} x
|
|
5019
5335
|
* @param {number} y
|
|
@@ -5029,6 +5345,41 @@ export class SchematicWrapper {
|
|
|
5029
5345
|
throw takeFromExternrefTable0(ret[0]);
|
|
5030
5346
|
}
|
|
5031
5347
|
}
|
|
5348
|
+
/**
|
|
5349
|
+
* Resize a 1D / diagonal periodic structure along its period vector,
|
|
5350
|
+
* producing `units` repeating cells.
|
|
5351
|
+
* @param {number} vx
|
|
5352
|
+
* @param {number} vy
|
|
5353
|
+
* @param {number} vz
|
|
5354
|
+
* @param {number} units
|
|
5355
|
+
* @returns {SchematicWrapper}
|
|
5356
|
+
*/
|
|
5357
|
+
autostackResize1d(vx, vy, vz, units) {
|
|
5358
|
+
const ret = wasm.schematicwrapper_autostackResize1d(this.__wbg_ptr, vx, vy, vz, units);
|
|
5359
|
+
if (ret[2]) {
|
|
5360
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5361
|
+
}
|
|
5362
|
+
return SchematicWrapper.__wrap(ret[0]);
|
|
5363
|
+
}
|
|
5364
|
+
/**
|
|
5365
|
+
* Resize a 2D periodic structure to `n1`×`n2` cells along the two vectors.
|
|
5366
|
+
* @param {number} v1x
|
|
5367
|
+
* @param {number} v1y
|
|
5368
|
+
* @param {number} v1z
|
|
5369
|
+
* @param {number} v2x
|
|
5370
|
+
* @param {number} v2y
|
|
5371
|
+
* @param {number} v2z
|
|
5372
|
+
* @param {number} n1
|
|
5373
|
+
* @param {number} n2
|
|
5374
|
+
* @returns {SchematicWrapper}
|
|
5375
|
+
*/
|
|
5376
|
+
autostackResize2d(v1x, v1y, v1z, v2x, v2y, v2z, n1, n2) {
|
|
5377
|
+
const ret = wasm.schematicwrapper_autostackResize2d(this.__wbg_ptr, v1x, v1y, v1z, v2x, v2y, v2z, n1, n2);
|
|
5378
|
+
if (ret[2]) {
|
|
5379
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5380
|
+
}
|
|
5381
|
+
return SchematicWrapper.__wrap(ret[0]);
|
|
5382
|
+
}
|
|
5032
5383
|
/**
|
|
5033
5384
|
* @param {string} format
|
|
5034
5385
|
* @returns {Array<any>}
|
|
@@ -5039,6 +5390,17 @@ export class SchematicWrapper {
|
|
|
5039
5390
|
const ret = wasm.schematicwrapper_get_format_versions(ptr0, len0);
|
|
5040
5391
|
return ret;
|
|
5041
5392
|
}
|
|
5393
|
+
/**
|
|
5394
|
+
* Remove the block entity at a position. Returns true if one was removed.
|
|
5395
|
+
* @param {number} x
|
|
5396
|
+
* @param {number} y
|
|
5397
|
+
* @param {number} z
|
|
5398
|
+
* @returns {boolean}
|
|
5399
|
+
*/
|
|
5400
|
+
removeBlockEntity(x, y, z) {
|
|
5401
|
+
const ret = wasm.schematicwrapper_removeBlockEntity(this.__wbg_ptr, x, y, z);
|
|
5402
|
+
return ret !== 0;
|
|
5403
|
+
}
|
|
5042
5404
|
/**
|
|
5043
5405
|
* @param {string} region_name
|
|
5044
5406
|
* @param {number} x
|
|
@@ -5055,6 +5417,20 @@ export class SchematicWrapper {
|
|
|
5055
5417
|
const ret = wasm.schematicwrapper_set_block_in_region(this.__wbg_ptr, ptr0, len0, x, y, z, ptr1, len1);
|
|
5056
5418
|
return ret !== 0;
|
|
5057
5419
|
}
|
|
5420
|
+
/**
|
|
5421
|
+
* Add a mobile entity from a full SNBT entity compound (must contain `id`
|
|
5422
|
+
* and `Pos`). The faithful, fully-typed entity write path — mirrors
|
|
5423
|
+
* `setBlockEntity` for block entities.
|
|
5424
|
+
* @param {string} snbt
|
|
5425
|
+
*/
|
|
5426
|
+
addEntityFromSnbt(snbt) {
|
|
5427
|
+
const ptr0 = passStringToWasm0(snbt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5428
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5429
|
+
const ret = wasm.schematicwrapper_addEntityFromSnbt(this.__wbg_ptr, ptr0, len0);
|
|
5430
|
+
if (ret[1]) {
|
|
5431
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5058
5434
|
/**
|
|
5059
5435
|
* @param {number} chunk_width
|
|
5060
5436
|
* @param {number} chunk_height
|
|
@@ -5135,6 +5511,21 @@ export class SchematicWrapper {
|
|
|
5135
5511
|
_assertClass(region, DefinitionRegionWrapper);
|
|
5136
5512
|
wasm.schematicwrapper_addDefinitionRegion(this.__wbg_ptr, ptr0, len0, region.__wbg_ptr);
|
|
5137
5513
|
}
|
|
5514
|
+
/**
|
|
5515
|
+
* Faithful, precision-safe block-entity read: the block entity's NBT as an
|
|
5516
|
+
* SNBT string (typed — `123L`, `1b`, etc.), or NULL if none. Unlike the
|
|
5517
|
+
* structured `nbt` object (which collapses `Long` to a JS double), SNBT
|
|
5518
|
+
* round-trips losslessly through `setBlockEntity`, so the editor can carry
|
|
5519
|
+
* untouched block entities verbatim.
|
|
5520
|
+
* @param {number} x
|
|
5521
|
+
* @param {number} y
|
|
5522
|
+
* @param {number} z
|
|
5523
|
+
* @returns {any}
|
|
5524
|
+
*/
|
|
5525
|
+
getBlockEntitySnbt(x, y, z) {
|
|
5526
|
+
const ret = wasm.schematicwrapper_getBlockEntitySnbt(this.__wbg_ptr, x, y, z);
|
|
5527
|
+
return ret;
|
|
5528
|
+
}
|
|
5138
5529
|
/**
|
|
5139
5530
|
* @param {string} name
|
|
5140
5531
|
* @returns {DefinitionRegionWrapper}
|
|
@@ -5171,10 +5562,18 @@ export class SchematicWrapper {
|
|
|
5171
5562
|
}
|
|
5172
5563
|
}
|
|
5173
5564
|
/**
|
|
5174
|
-
*
|
|
5565
|
+
* The canonical in-memory data version (the forward-conversion target).
|
|
5566
|
+
* @returns {number}
|
|
5567
|
+
*/
|
|
5568
|
+
static canonicalDataVersion() {
|
|
5569
|
+
const ret = wasm.schematicwrapper_canonicalDataVersion();
|
|
5570
|
+
return ret;
|
|
5571
|
+
}
|
|
5572
|
+
/**
|
|
5573
|
+
* @returns {CircuitBuilderWrapper}
|
|
5175
5574
|
*/
|
|
5176
5575
|
createCircuitBuilder() {
|
|
5177
|
-
const ret = wasm.
|
|
5576
|
+
const ret = wasm.circuitbuilderwrapper_new(this.__wbg_ptr);
|
|
5178
5577
|
return CircuitBuilderWrapper.__wrap(ret);
|
|
5179
5578
|
}
|
|
5180
5579
|
/**
|
|
@@ -5201,6 +5600,33 @@ export class SchematicWrapper {
|
|
|
5201
5600
|
const ret = wasm.schematicwrapper_get_all_block_entities(this.__wbg_ptr);
|
|
5202
5601
|
return ret;
|
|
5203
5602
|
}
|
|
5603
|
+
/**
|
|
5604
|
+
* Convert this schematic's block states / block entities / items between
|
|
5605
|
+
* Minecraft data versions, in place, returning a JSON array describing any
|
|
5606
|
+
* data loss (empty `[]` when lossless).
|
|
5607
|
+
*
|
|
5608
|
+
* Forward (target >= source) is faithful and lossless — the report is always
|
|
5609
|
+
* `[]`. Reverse (target < source, used to save for an older version) can be
|
|
5610
|
+
* lossy (the 1.13 Flattening, 1.20.5 components, item `Damage`, …); each
|
|
5611
|
+
* approximation/drop is reported as `{version, kind, severity, path, detail}`
|
|
5612
|
+
* so the tool can warn the user before saving. Conversion is never silent
|
|
5613
|
+
* about loss.
|
|
5614
|
+
* @param {number} target_data_version
|
|
5615
|
+
* @param {number} source_data_version
|
|
5616
|
+
* @returns {string}
|
|
5617
|
+
*/
|
|
5618
|
+
convertToDataVersion(target_data_version, source_data_version) {
|
|
5619
|
+
let deferred1_0;
|
|
5620
|
+
let deferred1_1;
|
|
5621
|
+
try {
|
|
5622
|
+
const ret = wasm.schematicwrapper_convertToDataVersion(this.__wbg_ptr, target_data_version, source_data_version);
|
|
5623
|
+
deferred1_0 = ret[0];
|
|
5624
|
+
deferred1_1 = ret[1];
|
|
5625
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5626
|
+
} finally {
|
|
5627
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
5628
|
+
}
|
|
5629
|
+
}
|
|
5204
5630
|
/**
|
|
5205
5631
|
* @param {string} name
|
|
5206
5632
|
* @param {number} x
|
|
@@ -5215,6 +5641,17 @@ export class SchematicWrapper {
|
|
|
5215
5641
|
throw takeFromExternrefTable0(ret[0]);
|
|
5216
5642
|
}
|
|
5217
5643
|
}
|
|
5644
|
+
/**
|
|
5645
|
+
* Graph-based detection: recovers **diagonal** lattice periods (e.g. a
|
|
5646
|
+
* diagonal carry-chain adder) that the pure-voxel `detectStructures` misses,
|
|
5647
|
+
* by extracting the redstone logic graph. Returns the same object shape.
|
|
5648
|
+
* Requires the `simulation` feature; returns `[]` for non-redstone builds.
|
|
5649
|
+
* @returns {any}
|
|
5650
|
+
*/
|
|
5651
|
+
detectStructuresGraph() {
|
|
5652
|
+
const ret = wasm.schematicwrapper_detectStructuresGraph(this.__wbg_ptr);
|
|
5653
|
+
return ret;
|
|
5654
|
+
}
|
|
5218
5655
|
/**
|
|
5219
5656
|
* @param {string} region_name
|
|
5220
5657
|
* @returns {any}
|
|
@@ -5235,6 +5672,24 @@ export class SchematicWrapper {
|
|
|
5235
5672
|
const ret = wasm.schematicwrapper_get_region_bounding_box(this.__wbg_ptr, ptr0, len0);
|
|
5236
5673
|
return ret;
|
|
5237
5674
|
}
|
|
5675
|
+
/**
|
|
5676
|
+
* The Minecraft data version of the file this schematic was loaded from
|
|
5677
|
+
* (captured by importers), or `None` for versionless/freshly-built schematics.
|
|
5678
|
+
* @returns {number | undefined}
|
|
5679
|
+
*/
|
|
5680
|
+
getSourceDataVersion() {
|
|
5681
|
+
const ret = wasm.schematicwrapper_getSourceDataVersion(this.__wbg_ptr);
|
|
5682
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
5683
|
+
}
|
|
5684
|
+
/**
|
|
5685
|
+
* Override the source data version — for formats that carry no Java data
|
|
5686
|
+
* version (classic `.schematic` ≈ 1343, raw imports), so the caller can tell
|
|
5687
|
+
* the converter what to convert *from*.
|
|
5688
|
+
* @param {number} version
|
|
5689
|
+
*/
|
|
5690
|
+
setSourceDataVersion(version) {
|
|
5691
|
+
wasm.schematicwrapper_setSourceDataVersion(this.__wbg_ptr, version);
|
|
5692
|
+
}
|
|
5238
5693
|
/**
|
|
5239
5694
|
* @param {string} name
|
|
5240
5695
|
*/
|
|
@@ -5279,6 +5734,23 @@ export class SchematicWrapper {
|
|
|
5279
5734
|
const ret = wasm.schematicwrapper_removeDefinitionRegion(this.__wbg_ptr, ptr0, len0);
|
|
5280
5735
|
return ret !== 0;
|
|
5281
5736
|
}
|
|
5737
|
+
/**
|
|
5738
|
+
* Serialize a `.litematic` targeting a specific Minecraft data version: a COPY
|
|
5739
|
+
* of the schematic's content is converted to `target_data_version` and the
|
|
5740
|
+
* matching schematic Version header (4=1.12 / 5=1.13–1.17 / 6=1.18–1.20.4 /
|
|
5741
|
+
* 7=1.20.5+) is written. Returns `{ bytes: Uint8Array, loss: <json> }`; `loss`
|
|
5742
|
+
* is the data-loss report from any down-conversion (empty `{}` when lossless),
|
|
5743
|
+
* so the UI can warn the user. The schematic itself is left unchanged.
|
|
5744
|
+
* @param {number} target_data_version
|
|
5745
|
+
* @returns {any}
|
|
5746
|
+
*/
|
|
5747
|
+
toLitematicForVersion(target_data_version) {
|
|
5748
|
+
const ret = wasm.schematicwrapper_toLitematicForVersion(this.__wbg_ptr, target_data_version);
|
|
5749
|
+
if (ret[2]) {
|
|
5750
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5751
|
+
}
|
|
5752
|
+
return takeFromExternrefTable0(ret[0]);
|
|
5753
|
+
}
|
|
5282
5754
|
/**
|
|
5283
5755
|
* @param {number} x
|
|
5284
5756
|
* @param {number} y
|
|
@@ -5388,6 +5860,18 @@ export class SchematicWrapper {
|
|
|
5388
5860
|
throw takeFromExternrefTable0(ret[0]);
|
|
5389
5861
|
}
|
|
5390
5862
|
}
|
|
5863
|
+
/**
|
|
5864
|
+
* Every block entity as `{id, position:[x,y,z], snbt}` — the batch,
|
|
5865
|
+
* precision-faithful read the editor bridge uses on load to attach each
|
|
5866
|
+
* block entity's full NBT (as a typed SNBT string) to its block. The `snbt`
|
|
5867
|
+
* is the block entity's inner data only (no `Id`/`Pos`); pair it with `id`
|
|
5868
|
+
* and the position when writing back via `setBlockEntity`.
|
|
5869
|
+
* @returns {Array<any>}
|
|
5870
|
+
*/
|
|
5871
|
+
getAllBlockEntitiesSnbt() {
|
|
5872
|
+
const ret = wasm.schematicwrapper_getAllBlockEntitiesSnbt(this.__wbg_ptr);
|
|
5873
|
+
return ret;
|
|
5874
|
+
}
|
|
5391
5875
|
/**
|
|
5392
5876
|
* @returns {Array<any>}
|
|
5393
5877
|
*/
|
|
@@ -5670,55 +6154,6 @@ export class SchematicWrapper {
|
|
|
5670
6154
|
const len0 = WASM_VECTOR_LEN;
|
|
5671
6155
|
wasm.schematicwrapper_set_block(this.__wbg_ptr, x, y, z, ptr0, len0);
|
|
5672
6156
|
}
|
|
5673
|
-
/**
|
|
5674
|
-
* Structurally diff this schematic against `other`.
|
|
5675
|
-
*
|
|
5676
|
-
* `preset` defaults to `"exact"`. `options` is an optional object
|
|
5677
|
-
* `{cost_add?, cost_delete?, cost_change?, cost_swap?, symmetry?}`.
|
|
5678
|
-
* Returns a [`DiffWrapper`]. Unknown preset/symmetry → Err.
|
|
5679
|
-
* @param {SchematicWrapper} other
|
|
5680
|
-
* @param {string | null | undefined} preset
|
|
5681
|
-
* @param {any} options
|
|
5682
|
-
* @returns {DiffWrapper}
|
|
5683
|
-
*/
|
|
5684
|
-
diff(other, preset, options) {
|
|
5685
|
-
_assertClass(other, SchematicWrapper);
|
|
5686
|
-
var ptr0 = isLikeNone(preset) ? 0 : passStringToWasm0(preset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5687
|
-
var len0 = WASM_VECTOR_LEN;
|
|
5688
|
-
const ret = wasm.schematicwrapper_diff(this.__wbg_ptr, other.__wbg_ptr, ptr0, len0, options);
|
|
5689
|
-
if (ret[2]) {
|
|
5690
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
5691
|
-
}
|
|
5692
|
-
return DiffWrapper.__wrap(ret[0]);
|
|
5693
|
-
}
|
|
5694
|
-
/**
|
|
5695
|
-
* Creates a simulation world for this schematic with default options
|
|
5696
|
-
*
|
|
5697
|
-
* This allows you to simulate redstone circuits and interact with them.
|
|
5698
|
-
* @returns {MchprsWorldWrapper}
|
|
5699
|
-
*/
|
|
5700
|
-
create_simulation_world() {
|
|
5701
|
-
const ret = wasm.schematicwrapper_create_simulation_world(this.__wbg_ptr);
|
|
5702
|
-
if (ret[2]) {
|
|
5703
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
5704
|
-
}
|
|
5705
|
-
return MchprsWorldWrapper.__wrap(ret[0]);
|
|
5706
|
-
}
|
|
5707
|
-
/**
|
|
5708
|
-
* Creates a simulation world for this schematic with custom options
|
|
5709
|
-
*
|
|
5710
|
-
* This allows you to configure simulation behavior like wire state tracking.
|
|
5711
|
-
* @param {SimulationOptionsWrapper} options
|
|
5712
|
-
* @returns {MchprsWorldWrapper}
|
|
5713
|
-
*/
|
|
5714
|
-
create_simulation_world_with_options(options) {
|
|
5715
|
-
_assertClass(options, SimulationOptionsWrapper);
|
|
5716
|
-
const ret = wasm.schematicwrapper_create_simulation_world_with_options(this.__wbg_ptr, options.__wbg_ptr);
|
|
5717
|
-
if (ret[2]) {
|
|
5718
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
5719
|
-
}
|
|
5720
|
-
return MchprsWorldWrapper.__wrap(ret[0]);
|
|
5721
|
-
}
|
|
5722
6157
|
/**
|
|
5723
6158
|
* Generate raw mesh data for custom rendering pipelines.
|
|
5724
6159
|
* @param {ResourcePackWrapper} pack
|
|
@@ -7072,6 +7507,243 @@ export class WasmBuildingTool {
|
|
|
7072
7507
|
}
|
|
7073
7508
|
if (Symbol.dispose) WasmBuildingTool.prototype[Symbol.dispose] = WasmBuildingTool.prototype.free;
|
|
7074
7509
|
|
|
7510
|
+
export class WorldChunkIterWrapper {
|
|
7511
|
+
static __wrap(ptr) {
|
|
7512
|
+
ptr = ptr >>> 0;
|
|
7513
|
+
const obj = Object.create(WorldChunkIterWrapper.prototype);
|
|
7514
|
+
obj.__wbg_ptr = ptr;
|
|
7515
|
+
WorldChunkIterWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7516
|
+
return obj;
|
|
7517
|
+
}
|
|
7518
|
+
__destroy_into_raw() {
|
|
7519
|
+
const ptr = this.__wbg_ptr;
|
|
7520
|
+
this.__wbg_ptr = 0;
|
|
7521
|
+
WorldChunkIterWrapperFinalization.unregister(this);
|
|
7522
|
+
return ptr;
|
|
7523
|
+
}
|
|
7524
|
+
free() {
|
|
7525
|
+
const ptr = this.__destroy_into_raw();
|
|
7526
|
+
wasm.__wbg_worldchunkiterwrapper_free(ptr, 0);
|
|
7527
|
+
}
|
|
7528
|
+
/**
|
|
7529
|
+
* Returns the next chunk, or `null`/`undefined` at the end of the stream.
|
|
7530
|
+
* Throws if the chunk is corrupt or unreadable.
|
|
7531
|
+
* @returns {WorldChunkViewWrapper | undefined}
|
|
7532
|
+
*/
|
|
7533
|
+
next() {
|
|
7534
|
+
const ret = wasm.worldchunkiterwrapper_next(this.__wbg_ptr);
|
|
7535
|
+
if (ret[2]) {
|
|
7536
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
7537
|
+
}
|
|
7538
|
+
return ret[0] === 0 ? undefined : WorldChunkViewWrapper.__wrap(ret[0]);
|
|
7539
|
+
}
|
|
7540
|
+
/**
|
|
7541
|
+
* @returns {boolean}
|
|
7542
|
+
*/
|
|
7543
|
+
has_next() {
|
|
7544
|
+
const ret = wasm.worldchunkiterwrapper_has_next(this.__wbg_ptr);
|
|
7545
|
+
return ret !== 0;
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7548
|
+
if (Symbol.dispose) WorldChunkIterWrapper.prototype[Symbol.dispose] = WorldChunkIterWrapper.prototype.free;
|
|
7549
|
+
|
|
7550
|
+
export class WorldChunkViewWrapper {
|
|
7551
|
+
static __wrap(ptr) {
|
|
7552
|
+
ptr = ptr >>> 0;
|
|
7553
|
+
const obj = Object.create(WorldChunkViewWrapper.prototype);
|
|
7554
|
+
obj.__wbg_ptr = ptr;
|
|
7555
|
+
WorldChunkViewWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7556
|
+
return obj;
|
|
7557
|
+
}
|
|
7558
|
+
__destroy_into_raw() {
|
|
7559
|
+
const ptr = this.__wbg_ptr;
|
|
7560
|
+
this.__wbg_ptr = 0;
|
|
7561
|
+
WorldChunkViewWrapperFinalization.unregister(this);
|
|
7562
|
+
return ptr;
|
|
7563
|
+
}
|
|
7564
|
+
free() {
|
|
7565
|
+
const ptr = this.__destroy_into_raw();
|
|
7566
|
+
wasm.__wbg_worldchunkviewwrapper_free(ptr, 0);
|
|
7567
|
+
}
|
|
7568
|
+
/**
|
|
7569
|
+
* @returns {SchematicWrapper}
|
|
7570
|
+
*/
|
|
7571
|
+
to_schematic() {
|
|
7572
|
+
const ret = wasm.worldchunkviewwrapper_to_schematic(this.__wbg_ptr);
|
|
7573
|
+
return SchematicWrapper.__wrap(ret);
|
|
7574
|
+
}
|
|
7575
|
+
/**
|
|
7576
|
+
* Deduped union of all sections' biome palette entries, in order of
|
|
7577
|
+
* first appearance. Empty if no section carries biome data.
|
|
7578
|
+
* @returns {string[]}
|
|
7579
|
+
*/
|
|
7580
|
+
biome_palette() {
|
|
7581
|
+
const ret = wasm.worldchunkviewwrapper_biome_palette(this.__wbg_ptr);
|
|
7582
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
7583
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
7584
|
+
return v1;
|
|
7585
|
+
}
|
|
7586
|
+
/**
|
|
7587
|
+
* @returns {number}
|
|
7588
|
+
*/
|
|
7589
|
+
cx() {
|
|
7590
|
+
const ret = wasm.worldchunkviewwrapper_cx(this.__wbg_ptr);
|
|
7591
|
+
return ret;
|
|
7592
|
+
}
|
|
7593
|
+
/**
|
|
7594
|
+
* @returns {number}
|
|
7595
|
+
*/
|
|
7596
|
+
cz() {
|
|
7597
|
+
const ret = wasm.worldchunkviewwrapper_cz(this.__wbg_ptr);
|
|
7598
|
+
return ret;
|
|
7599
|
+
}
|
|
7600
|
+
/**
|
|
7601
|
+
* Create an empty chunk at the given chunk coordinates — the starting
|
|
7602
|
+
* point for generating chunks from scratch. Sections are created on
|
|
7603
|
+
* demand by `set_block`. In WASM there is no `WorldSink` (no filesystem),
|
|
7604
|
+
* so fabricated chunks are used via `to_schematic()` or direct inspection
|
|
7605
|
+
* (`get_block`, `y_range`, ...).
|
|
7606
|
+
* @param {number} cx
|
|
7607
|
+
* @param {number} cz
|
|
7608
|
+
*/
|
|
7609
|
+
constructor(cx, cz) {
|
|
7610
|
+
const ret = wasm.worldchunkviewwrapper_new(cx, cz);
|
|
7611
|
+
this.__wbg_ptr = ret >>> 0;
|
|
7612
|
+
WorldChunkViewWrapperFinalization.register(this, this.__wbg_ptr, this);
|
|
7613
|
+
return this;
|
|
7614
|
+
}
|
|
7615
|
+
/**
|
|
7616
|
+
* Returns `[min_y, max_y]` (inclusive on both ends).
|
|
7617
|
+
* @returns {Int32Array}
|
|
7618
|
+
*/
|
|
7619
|
+
y_range() {
|
|
7620
|
+
const ret = wasm.worldchunkviewwrapper_y_range(this.__wbg_ptr);
|
|
7621
|
+
var v1 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
|
|
7622
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
7623
|
+
return v1;
|
|
7624
|
+
}
|
|
7625
|
+
/**
|
|
7626
|
+
* Returns the block name at world coordinates (e.g. `"minecraft:air"` for air cells),
|
|
7627
|
+
* or `undefined`/`null` if the coordinates fall outside the chunk's loaded sections.
|
|
7628
|
+
* @param {number} x
|
|
7629
|
+
* @param {number} y
|
|
7630
|
+
* @param {number} z
|
|
7631
|
+
* @returns {string | undefined}
|
|
7632
|
+
*/
|
|
7633
|
+
get_block(x, y, z) {
|
|
7634
|
+
const ret = wasm.worldchunkviewwrapper_get_block(this.__wbg_ptr, x, y, z);
|
|
7635
|
+
let v1;
|
|
7636
|
+
if (ret[0] !== 0) {
|
|
7637
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
7638
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
7639
|
+
}
|
|
7640
|
+
return v1;
|
|
7641
|
+
}
|
|
7642
|
+
/**
|
|
7643
|
+
* Overwrite the biome of every currently-present section with
|
|
7644
|
+
* `biome_name` (e.g. `"minecraft:desert"`). Sections are created lazily
|
|
7645
|
+
* by `set_block`, so call this AFTER placing blocks. Coarse chunk-level
|
|
7646
|
+
* control; existing multi-biome data round-trips losslessly if you
|
|
7647
|
+
* don't call this.
|
|
7648
|
+
* @param {string} biome_name
|
|
7649
|
+
*/
|
|
7650
|
+
set_biome(biome_name) {
|
|
7651
|
+
const ptr0 = passStringToWasm0(biome_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
7652
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7653
|
+
wasm.worldchunkviewwrapper_set_biome(this.__wbg_ptr, ptr0, len0);
|
|
7654
|
+
}
|
|
7655
|
+
/**
|
|
7656
|
+
* Set the block at world coordinates `(x, y, z)` by name. Returns `true`
|
|
7657
|
+
* on success, `false` if `(x, z)` falls outside this chunk. Creates the
|
|
7658
|
+
* section if the Y level has none.
|
|
7659
|
+
* @param {number} x
|
|
7660
|
+
* @param {number} y
|
|
7661
|
+
* @param {number} z
|
|
7662
|
+
* @param {string} block_name
|
|
7663
|
+
* @returns {boolean}
|
|
7664
|
+
*/
|
|
7665
|
+
set_block(x, y, z, block_name) {
|
|
7666
|
+
const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
7667
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7668
|
+
const ret = wasm.worldchunkviewwrapper_set_block(this.__wbg_ptr, x, y, z, ptr0, len0);
|
|
7669
|
+
return ret !== 0;
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7672
|
+
if (Symbol.dispose) WorldChunkViewWrapper.prototype[Symbol.dispose] = WorldChunkViewWrapper.prototype.free;
|
|
7673
|
+
|
|
7674
|
+
export class WorldSourceWrapper {
|
|
7675
|
+
static __wrap(ptr) {
|
|
7676
|
+
ptr = ptr >>> 0;
|
|
7677
|
+
const obj = Object.create(WorldSourceWrapper.prototype);
|
|
7678
|
+
obj.__wbg_ptr = ptr;
|
|
7679
|
+
WorldSourceWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7680
|
+
return obj;
|
|
7681
|
+
}
|
|
7682
|
+
__destroy_into_raw() {
|
|
7683
|
+
const ptr = this.__wbg_ptr;
|
|
7684
|
+
this.__wbg_ptr = 0;
|
|
7685
|
+
WorldSourceWrapperFinalization.unregister(this);
|
|
7686
|
+
return ptr;
|
|
7687
|
+
}
|
|
7688
|
+
free() {
|
|
7689
|
+
const ptr = this.__destroy_into_raw();
|
|
7690
|
+
wasm.__wbg_worldsourcewrapper_free(ptr, 0);
|
|
7691
|
+
}
|
|
7692
|
+
/**
|
|
7693
|
+
* @param {number} min_x
|
|
7694
|
+
* @param {number} min_y
|
|
7695
|
+
* @param {number} min_z
|
|
7696
|
+
* @param {number} max_x
|
|
7697
|
+
* @param {number} max_y
|
|
7698
|
+
* @param {number} max_z
|
|
7699
|
+
* @returns {WorldChunkIterWrapper}
|
|
7700
|
+
*/
|
|
7701
|
+
chunks_bounded(min_x, min_y, min_z, max_x, max_y, max_z) {
|
|
7702
|
+
const ret = wasm.worldsourcewrapper_chunks_bounded(this.__wbg_ptr, min_x, min_y, min_z, max_x, max_y, max_z);
|
|
7703
|
+
if (ret[2]) {
|
|
7704
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
7705
|
+
}
|
|
7706
|
+
return WorldChunkIterWrapper.__wrap(ret[0]);
|
|
7707
|
+
}
|
|
7708
|
+
/**
|
|
7709
|
+
* @param {Uint8Array} data
|
|
7710
|
+
* @returns {WorldSourceWrapper}
|
|
7711
|
+
*/
|
|
7712
|
+
static from_mca_bytes(data) {
|
|
7713
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
7714
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7715
|
+
const ret = wasm.worldsourcewrapper_from_mca_bytes(ptr0, len0);
|
|
7716
|
+
if (ret[2]) {
|
|
7717
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
7718
|
+
}
|
|
7719
|
+
return WorldSourceWrapper.__wrap(ret[0]);
|
|
7720
|
+
}
|
|
7721
|
+
/**
|
|
7722
|
+
* @param {Uint8Array} data
|
|
7723
|
+
* @returns {WorldSourceWrapper}
|
|
7724
|
+
*/
|
|
7725
|
+
static from_zip_bytes(data) {
|
|
7726
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
7727
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7728
|
+
const ret = wasm.worldsourcewrapper_from_zip_bytes(ptr0, len0);
|
|
7729
|
+
if (ret[2]) {
|
|
7730
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
7731
|
+
}
|
|
7732
|
+
return WorldSourceWrapper.__wrap(ret[0]);
|
|
7733
|
+
}
|
|
7734
|
+
/**
|
|
7735
|
+
* @returns {WorldChunkIterWrapper}
|
|
7736
|
+
*/
|
|
7737
|
+
chunks() {
|
|
7738
|
+
const ret = wasm.worldsourcewrapper_chunks(this.__wbg_ptr);
|
|
7739
|
+
if (ret[2]) {
|
|
7740
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
7741
|
+
}
|
|
7742
|
+
return WorldChunkIterWrapper.__wrap(ret[0]);
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7745
|
+
if (Symbol.dispose) WorldSourceWrapper.prototype[Symbol.dispose] = WorldSourceWrapper.prototype.free;
|
|
7746
|
+
|
|
7075
7747
|
/**
|
|
7076
7748
|
* Build a resource pack ZIP from multiple item model results.
|
|
7077
7749
|
*
|
|
@@ -7333,6 +8005,10 @@ function __wbg_get_imports() {
|
|
|
7333
8005
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
7334
8006
|
return ret;
|
|
7335
8007
|
}, arguments) };
|
|
8008
|
+
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
8009
|
+
const ret = arg0.crypto;
|
|
8010
|
+
return ret;
|
|
8011
|
+
};
|
|
7336
8012
|
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
|
|
7337
8013
|
const ret = Object.entries(arg0);
|
|
7338
8014
|
return ret;
|
|
@@ -7355,6 +8031,9 @@ function __wbg_get_imports() {
|
|
|
7355
8031
|
const ret = Array.from(arg0);
|
|
7356
8032
|
return ret;
|
|
7357
8033
|
};
|
|
8034
|
+
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
8035
|
+
arg0.getRandomValues(arg1);
|
|
8036
|
+
}, arguments) };
|
|
7358
8037
|
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
7359
8038
|
const ret = arg0[arg1 >>> 0];
|
|
7360
8039
|
return ret;
|
|
@@ -7406,6 +8085,10 @@ function __wbg_get_imports() {
|
|
|
7406
8085
|
imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
|
|
7407
8086
|
console.log(arg0);
|
|
7408
8087
|
};
|
|
8088
|
+
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
8089
|
+
const ret = arg0.msCrypto;
|
|
8090
|
+
return ret;
|
|
8091
|
+
};
|
|
7409
8092
|
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
7410
8093
|
const ret = new Object();
|
|
7411
8094
|
return ret;
|
|
@@ -7442,6 +8125,10 @@ function __wbg_get_imports() {
|
|
|
7442
8125
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
7443
8126
|
return ret;
|
|
7444
8127
|
};
|
|
8128
|
+
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
8129
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
8130
|
+
return ret;
|
|
8131
|
+
};
|
|
7445
8132
|
imports.wbg.__wbg_new_with_length_12c6de4fac33117a = function(arg0) {
|
|
7446
8133
|
const ret = new Array(arg0 >>> 0);
|
|
7447
8134
|
return ret;
|
|
@@ -7450,6 +8137,10 @@ function __wbg_get_imports() {
|
|
|
7450
8137
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
7451
8138
|
return ret;
|
|
7452
8139
|
};
|
|
8140
|
+
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
8141
|
+
const ret = arg0.node;
|
|
8142
|
+
return ret;
|
|
8143
|
+
};
|
|
7453
8144
|
imports.wbg.__wbg_now_69d776cd24f5215b = function() {
|
|
7454
8145
|
const ret = Date.now();
|
|
7455
8146
|
return ret;
|
|
@@ -7458,6 +8149,14 @@ function __wbg_get_imports() {
|
|
|
7458
8149
|
const ret = Array.of(arg0, arg1, arg2);
|
|
7459
8150
|
return ret;
|
|
7460
8151
|
};
|
|
8152
|
+
imports.wbg.__wbg_parse_a09a54cf72639456 = function() { return handleError(function (arg0, arg1) {
|
|
8153
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
8154
|
+
return ret;
|
|
8155
|
+
}, arguments) };
|
|
8156
|
+
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
8157
|
+
const ret = arg0.process;
|
|
8158
|
+
return ret;
|
|
8159
|
+
};
|
|
7461
8160
|
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
7462
8161
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
7463
8162
|
};
|
|
@@ -7465,6 +8164,13 @@ function __wbg_get_imports() {
|
|
|
7465
8164
|
const ret = arg0.push(arg1);
|
|
7466
8165
|
return ret;
|
|
7467
8166
|
};
|
|
8167
|
+
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
8168
|
+
arg0.randomFillSync(arg1);
|
|
8169
|
+
}, arguments) };
|
|
8170
|
+
imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
8171
|
+
const ret = module.require;
|
|
8172
|
+
return ret;
|
|
8173
|
+
}, arguments) };
|
|
7468
8174
|
imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {
|
|
7469
8175
|
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
7470
8176
|
};
|
|
@@ -7492,6 +8198,30 @@ function __wbg_get_imports() {
|
|
|
7492
8198
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
7493
8199
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
7494
8200
|
};
|
|
8201
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
8202
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
8203
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
8204
|
+
};
|
|
8205
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
8206
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
8207
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
8208
|
+
};
|
|
8209
|
+
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
8210
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
8211
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
8212
|
+
};
|
|
8213
|
+
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
8214
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
8215
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
8216
|
+
};
|
|
8217
|
+
imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
|
|
8218
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
8219
|
+
return ret;
|
|
8220
|
+
};
|
|
8221
|
+
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
8222
|
+
const ret = arg0.versions;
|
|
8223
|
+
return ret;
|
|
8224
|
+
};
|
|
7495
8225
|
imports.wbg.__wbg_warn_6e567d0d926ff881 = function(arg0) {
|
|
7496
8226
|
console.warn(arg0);
|
|
7497
8227
|
};
|
|
@@ -7510,6 +8240,11 @@ function __wbg_get_imports() {
|
|
|
7510
8240
|
const ret = arg0;
|
|
7511
8241
|
return ret;
|
|
7512
8242
|
};
|
|
8243
|
+
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
8244
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
8245
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
8246
|
+
return ret;
|
|
8247
|
+
};
|
|
7513
8248
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
7514
8249
|
// Cast intrinsic for `F64 -> Externref`.
|
|
7515
8250
|
const ret = arg0;
|