nucleation 0.10.21 → 0.10.23
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/BlockPos.mjs +1 -0
- package/Dimensions.mjs +1 -0
- package/FieldRange.mjs +1 -0
- package/ItemScale.mjs +1 -0
- package/MeshBounds.mjs +1 -0
- package/MeshProgress.mjs +1 -0
- package/README.md +12 -0
- package/RegionBounds.mjs +1 -0
- package/Schematic.d.mts +32 -0
- package/Schematic.d.ts +32 -0
- package/Schematic.mjs +100 -0
- package/SdfBounds.mjs +1 -0
- package/SdfNormal.mjs +1 -0
- package/TextureInfo.mjs +1 -0
- package/diplomat-runtime.mjs +19 -14
- package/nucleation.wasm +0 -0
- package/package.json +7 -2
- package/renderer/AnimationEffect.d.mts +44 -0
- package/renderer/AnimationEffect.d.ts +44 -0
- package/renderer/AnimationEffect.mjs +204 -0
- package/renderer/Autostack.d.mts +43 -0
- package/renderer/Autostack.d.ts +43 -0
- package/renderer/Autostack.mjs +134 -0
- package/renderer/BlockPos.d.mts +28 -0
- package/renderer/BlockPos.d.ts +28 -0
- package/renderer/BlockPos.mjs +130 -0
- package/renderer/BlockState.d.mts +39 -0
- package/renderer/BlockState.d.ts +39 -0
- package/renderer/BlockState.mjs +134 -0
- package/renderer/Blocks.d.mts +91 -0
- package/renderer/Blocks.d.ts +91 -0
- package/renderer/Blocks.mjs +308 -0
- package/renderer/Brush.d.mts +99 -0
- package/renderer/Brush.d.ts +99 -0
- package/renderer/Brush.mjs +335 -0
- package/renderer/BuildAnimation.d.mts +179 -0
- package/renderer/BuildAnimation.d.ts +179 -0
- package/renderer/BuildAnimation.mjs +1148 -0
- package/renderer/BuildingTool.d.mts +46 -0
- package/renderer/BuildingTool.d.ts +46 -0
- package/renderer/BuildingTool.mjs +121 -0
- package/renderer/CellExecutor.d.mts +51 -0
- package/renderer/CellExecutor.d.ts +51 -0
- package/renderer/CellExecutor.mjs +171 -0
- package/renderer/CellularSdfConfig.d.mts +22 -0
- package/renderer/CellularSdfConfig.d.ts +22 -0
- package/renderer/CellularSdfConfig.mjs +69 -0
- package/renderer/ChunkMeshResult.d.mts +75 -0
- package/renderer/ChunkMeshResult.d.ts +75 -0
- package/renderer/ChunkMeshResult.mjs +253 -0
- package/renderer/CircuitBuilder.d.mts +118 -0
- package/renderer/CircuitBuilder.d.ts +118 -0
- package/renderer/CircuitBuilder.mjs +516 -0
- package/renderer/Curve3D.d.mts +27 -0
- package/renderer/Curve3D.d.ts +27 -0
- package/renderer/Curve3D.mjs +101 -0
- package/renderer/DefinitionRegion.d.mts +274 -0
- package/renderer/DefinitionRegion.d.ts +274 -0
- package/renderer/DefinitionRegion.mjs +973 -0
- package/renderer/Design.d.mts +348 -0
- package/renderer/Design.d.ts +348 -0
- package/renderer/Design.mjs +1334 -0
- package/renderer/Diff.d.mts +88 -0
- package/renderer/Diff.d.ts +88 -0
- package/renderer/Diff.mjs +316 -0
- package/renderer/Dimensions.d.mts +28 -0
- package/renderer/Dimensions.d.ts +28 -0
- package/renderer/Dimensions.mjs +130 -0
- package/renderer/DistanceField.d.mts +39 -0
- package/renderer/DistanceField.d.ts +39 -0
- package/renderer/DistanceField.mjs +114 -0
- package/renderer/ExecutionMode.d.mts +42 -0
- package/renderer/ExecutionMode.d.ts +42 -0
- package/renderer/ExecutionMode.mjs +127 -0
- package/renderer/Field3.d.mts +40 -0
- package/renderer/Field3.d.ts +40 -0
- package/renderer/Field3.mjs +160 -0
- package/renderer/FieldProgram.d.mts +40 -0
- package/renderer/FieldProgram.d.ts +40 -0
- package/renderer/FieldProgram.mjs +167 -0
- package/renderer/FieldProgramBinaryOp.d.mts +42 -0
- package/renderer/FieldProgramBinaryOp.d.ts +42 -0
- package/renderer/FieldProgramBinaryOp.mjs +118 -0
- package/renderer/FieldProgramBuilder.d.mts +104 -0
- package/renderer/FieldProgramBuilder.d.ts +104 -0
- package/renderer/FieldProgramBuilder.mjs +486 -0
- package/renderer/FieldProgramDistanceKind.d.mts +26 -0
- package/renderer/FieldProgramDistanceKind.d.ts +26 -0
- package/renderer/FieldProgramDistanceKind.mjs +78 -0
- package/renderer/FieldProgramUnaryOp.d.mts +34 -0
- package/renderer/FieldProgramUnaryOp.d.ts +34 -0
- package/renderer/FieldProgramUnaryOp.mjs +102 -0
- package/renderer/FieldProgramValueType.d.mts +25 -0
- package/renderer/FieldProgramValueType.d.ts +25 -0
- package/renderer/FieldProgramValueType.mjs +75 -0
- package/renderer/FieldRange.d.mts +15 -0
- package/renderer/FieldRange.d.ts +15 -0
- package/renderer/FieldRange.mjs +109 -0
- package/renderer/Fingerprint.d.mts +44 -0
- package/renderer/Fingerprint.d.ts +44 -0
- package/renderer/Fingerprint.mjs +197 -0
- package/renderer/GeneratedChunk.d.mts +35 -0
- package/renderer/GeneratedChunk.d.ts +35 -0
- package/renderer/GeneratedChunk.mjs +178 -0
- package/renderer/GeneratedChunkCoverage.d.mts +25 -0
- package/renderer/GeneratedChunkCoverage.d.ts +25 -0
- package/renderer/GeneratedChunkCoverage.mjs +75 -0
- package/renderer/GeneratedChunkOverlayMode.d.mts +24 -0
- package/renderer/GeneratedChunkOverlayMode.d.ts +24 -0
- package/renderer/GeneratedChunkOverlayMode.mjs +72 -0
- package/renderer/GeneratedWorldStream.d.mts +28 -0
- package/renderer/GeneratedWorldStream.d.ts +28 -0
- package/renderer/GeneratedWorldStream.mjs +86 -0
- package/renderer/Geo.d.mts +41 -0
- package/renderer/Geo.d.ts +41 -0
- package/renderer/Geo.mjs +121 -0
- package/renderer/Hdl.d.mts +56 -0
- package/renderer/Hdl.d.ts +56 -0
- package/renderer/Hdl.mjs +163 -0
- package/renderer/InterpolationSpace.d.mts +25 -0
- package/renderer/InterpolationSpace.d.ts +25 -0
- package/renderer/InterpolationSpace.mjs +73 -0
- package/renderer/IoLayout.d.mts +26 -0
- package/renderer/IoLayout.d.ts +26 -0
- package/renderer/IoLayout.mjs +81 -0
- package/renderer/IoLayoutBuilder.d.mts +73 -0
- package/renderer/IoLayoutBuilder.d.ts +73 -0
- package/renderer/IoLayoutBuilder.mjs +315 -0
- package/renderer/IoType.d.mts +41 -0
- package/renderer/IoType.d.ts +41 -0
- package/renderer/IoType.mjs +125 -0
- package/renderer/ItemModelConfig.d.mts +65 -0
- package/renderer/ItemModelConfig.d.ts +65 -0
- package/renderer/ItemModelConfig.mjs +223 -0
- package/renderer/ItemModelPackBuilder.d.mts +32 -0
- package/renderer/ItemModelPackBuilder.d.ts +32 -0
- package/renderer/ItemModelPackBuilder.mjs +104 -0
- package/renderer/ItemModelResult.d.mts +72 -0
- package/renderer/ItemModelResult.d.ts +72 -0
- package/renderer/ItemModelResult.mjs +268 -0
- package/renderer/ItemScale.d.mts +31 -0
- package/renderer/ItemScale.d.ts +31 -0
- package/renderer/ItemScale.mjs +133 -0
- package/renderer/LayoutFunction.d.mts +52 -0
- package/renderer/LayoutFunction.d.ts +52 -0
- package/renderer/LayoutFunction.mjs +159 -0
- package/renderer/MchprsWorld.d.mts +131 -0
- package/renderer/MchprsWorld.d.ts +131 -0
- package/renderer/MchprsWorld.mjs +423 -0
- package/renderer/MeshBounds.d.mts +40 -0
- package/renderer/MeshBounds.d.ts +40 -0
- package/renderer/MeshBounds.mjs +181 -0
- package/renderer/MeshConfig.d.mts +101 -0
- package/renderer/MeshConfig.d.ts +101 -0
- package/renderer/MeshConfig.mjs +306 -0
- package/renderer/MeshJob.d.mts +44 -0
- package/renderer/MeshJob.d.ts +44 -0
- package/renderer/MeshJob.mjs +116 -0
- package/renderer/MeshPhase.d.mts +38 -0
- package/renderer/MeshPhase.d.ts +38 -0
- package/renderer/MeshPhase.mjs +90 -0
- package/renderer/MeshProgress.d.mts +32 -0
- package/renderer/MeshProgress.d.ts +32 -0
- package/renderer/MeshProgress.mjs +134 -0
- package/renderer/MeshResult.d.mts +76 -0
- package/renderer/MeshResult.d.ts +76 -0
- package/renderer/MeshResult.mjs +269 -0
- package/renderer/MultiMeshResult.d.mts +50 -0
- package/renderer/MultiMeshResult.d.ts +50 -0
- package/renderer/MultiMeshResult.mjs +166 -0
- package/renderer/Nbt.d.mts +50 -0
- package/renderer/Nbt.d.ts +50 -0
- package/renderer/Nbt.mjs +161 -0
- package/renderer/NucleationError.d.mts +53 -0
- package/renderer/NucleationError.d.ts +53 -0
- package/renderer/NucleationError.mjs +136 -0
- package/renderer/OutputCondition.d.mts +45 -0
- package/renderer/OutputCondition.d.ts +45 -0
- package/renderer/OutputCondition.mjs +129 -0
- package/renderer/Palette.d.mts +157 -0
- package/renderer/Palette.d.ts +157 -0
- package/renderer/Palette.mjs +487 -0
- package/renderer/PaletteBuilder.d.mts +119 -0
- package/renderer/PaletteBuilder.d.ts +119 -0
- package/renderer/PaletteBuilder.mjs +457 -0
- package/renderer/README.md +67 -0
- package/renderer/RawMeshExport.d.mts +74 -0
- package/renderer/RawMeshExport.d.ts +74 -0
- package/renderer/RawMeshExport.mjs +243 -0
- package/renderer/RedstoneGraph.d.mts +58 -0
- package/renderer/RedstoneGraph.d.ts +58 -0
- package/renderer/RedstoneGraph.mjs +242 -0
- package/renderer/RegionBounds.d.mts +41 -0
- package/renderer/RegionBounds.d.ts +41 -0
- package/renderer/RegionBounds.mjs +182 -0
- package/renderer/RenderConfig.d.mts +101 -0
- package/renderer/RenderConfig.d.ts +101 -0
- package/renderer/RenderConfig.mjs +271 -0
- package/renderer/Renderer.d.mts +51 -0
- package/renderer/Renderer.d.ts +51 -0
- package/renderer/Renderer.mjs +219 -0
- package/renderer/ResourcePack.d.mts +105 -0
- package/renderer/ResourcePack.d.ts +105 -0
- package/renderer/ResourcePack.mjs +447 -0
- package/renderer/ResourcePackList.d.mts +32 -0
- package/renderer/ResourcePackList.d.ts +32 -0
- package/renderer/ResourcePackList.mjs +96 -0
- package/renderer/Routing.d.mts +66 -0
- package/renderer/Routing.d.ts +66 -0
- package/renderer/Routing.mjs +220 -0
- package/renderer/Schematic.d.mts +977 -0
- package/renderer/Schematic.d.ts +977 -0
- package/renderer/Schematic.mjs +3820 -0
- package/renderer/SchematicBuilder.d.mts +103 -0
- package/renderer/SchematicBuilder.d.ts +103 -0
- package/renderer/SchematicBuilder.mjs +401 -0
- package/renderer/SchematicRegions.d.mts +93 -0
- package/renderer/SchematicRegions.d.ts +93 -0
- package/renderer/SchematicRegions.mjs +411 -0
- package/renderer/SchematicSplitResult.d.mts +26 -0
- package/renderer/SchematicSplitResult.d.ts +26 -0
- package/renderer/SchematicSplitResult.mjs +84 -0
- package/renderer/Scripting.d.mts +40 -0
- package/renderer/Scripting.d.ts +40 -0
- package/renderer/Scripting.mjs +138 -0
- package/renderer/Sdf.d.mts +234 -0
- package/renderer/Sdf.d.ts +234 -0
- package/renderer/Sdf.mjs +1234 -0
- package/renderer/SdfAxis.d.mts +25 -0
- package/renderer/SdfAxis.d.ts +25 -0
- package/renderer/SdfAxis.mjs +75 -0
- package/renderer/SdfBounds.d.mts +19 -0
- package/renderer/SdfBounds.d.ts +19 -0
- package/renderer/SdfBounds.mjs +161 -0
- package/renderer/SdfCellMode.d.mts +26 -0
- package/renderer/SdfCellMode.d.ts +26 -0
- package/renderer/SdfCellMode.mjs +78 -0
- package/renderer/SdfNormal.d.mts +16 -0
- package/renderer/SdfNormal.d.ts +16 -0
- package/renderer/SdfNormal.mjs +122 -0
- package/renderer/Shape.d.mts +143 -0
- package/renderer/Shape.d.ts +143 -0
- package/renderer/Shape.mjs +458 -0
- package/renderer/SortStrategy.d.mts +86 -0
- package/renderer/SortStrategy.d.ts +86 -0
- package/renderer/SortStrategy.mjs +272 -0
- package/renderer/Store.d.mts +83 -0
- package/renderer/Store.d.ts +83 -0
- package/renderer/Store.mjs +369 -0
- package/renderer/StoreIo.d.mts +71 -0
- package/renderer/StoreIo.d.ts +71 -0
- package/renderer/StoreIo.mjs +292 -0
- package/renderer/TextureAtlas.d.mts +40 -0
- package/renderer/TextureAtlas.d.ts +40 -0
- package/renderer/TextureAtlas.mjs +122 -0
- package/renderer/TextureInfo.d.mts +34 -0
- package/renderer/TextureInfo.d.ts +34 -0
- package/renderer/TextureInfo.mjs +149 -0
- package/renderer/TickSettleMode.d.mts +34 -0
- package/renderer/TickSettleMode.d.ts +34 -0
- package/renderer/TickSettleMode.mjs +84 -0
- package/renderer/TickSimulation.d.mts +572 -0
- package/renderer/TickSimulation.d.ts +572 -0
- package/renderer/TickSimulation.mjs +1299 -0
- package/renderer/TypedCircuitExecutor.d.mts +101 -0
- package/renderer/TypedCircuitExecutor.d.ts +101 -0
- package/renderer/TypedCircuitExecutor.mjs +378 -0
- package/renderer/Value.d.mts +73 -0
- package/renderer/Value.d.ts +73 -0
- package/renderer/Value.mjs +275 -0
- package/renderer/VideoConfig.d.mts +15 -0
- package/renderer/VideoConfig.d.ts +15 -0
- package/renderer/VideoConfig.mjs +44 -0
- package/renderer/VoxelModel.d.mts +34 -0
- package/renderer/VoxelModel.d.ts +34 -0
- package/renderer/VoxelModel.mjs +113 -0
- package/renderer/Voxelizer.d.mts +80 -0
- package/renderer/Voxelizer.d.ts +80 -0
- package/renderer/Voxelizer.mjs +261 -0
- package/renderer/WorldChunkView.d.mts +75 -0
- package/renderer/WorldChunkView.d.ts +75 -0
- package/renderer/WorldChunkView.mjs +224 -0
- package/renderer/WorldGenerator.d.mts +75 -0
- package/renderer/WorldGenerator.d.ts +75 -0
- package/renderer/WorldGenerator.mjs +255 -0
- package/renderer/WorldSink.d.mts +50 -0
- package/renderer/WorldSink.d.ts +50 -0
- package/renderer/WorldSink.mjs +177 -0
- package/renderer/WorldStream.d.mts +45 -0
- package/renderer/WorldStream.d.ts +45 -0
- package/renderer/WorldStream.mjs +184 -0
- package/renderer/WsPartitionHints.d.mts +29 -0
- package/renderer/WsPartitionHints.d.ts +29 -0
- package/renderer/WsPartitionHints.mjs +102 -0
- package/renderer/WsProfile.d.mts +46 -0
- package/renderer/WsProfile.d.ts +46 -0
- package/renderer/WsProfile.mjs +152 -0
- package/renderer/WsRunResult.d.mts +83 -0
- package/renderer/WsRunResult.d.ts +83 -0
- package/renderer/WsRunResult.mjs +326 -0
- package/renderer/WsSegmentJob.d.mts +28 -0
- package/renderer/WsSegmentJob.d.ts +28 -0
- package/renderer/WsSegmentJob.mjs +81 -0
- package/renderer/diplomat-runtime.d.mts +15 -0
- package/renderer/diplomat-runtime.d.ts +15 -0
- package/renderer/diplomat-runtime.mjs +779 -0
- package/renderer/diplomat-wasm.mjs +52 -0
- package/renderer/diplomat.config.mjs +5 -0
- package/renderer/index.d.mts +193 -0
- package/renderer/index.d.ts +193 -0
- package/renderer/index.mjs +196 -0
- package/renderer/nucleation.wasm +0 -0
- package/renderer/veneer/design.d.ts +167 -0
- package/renderer/veneer/design.mjs +480 -0
|
@@ -0,0 +1,3820 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import { BlockPos } from "./BlockPos.mjs"
|
|
3
|
+
import { BlockState } from "./BlockState.mjs"
|
|
4
|
+
import { Dimensions } from "./Dimensions.mjs"
|
|
5
|
+
import { NucleationError } from "./NucleationError.mjs"
|
|
6
|
+
import { SchematicSplitResult } from "./SchematicSplitResult.mjs"
|
|
7
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
8
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
9
|
+
|
|
10
|
+
const Schematic_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
11
|
+
wasm.Schematic_destroy(ptr);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class Schematic {
|
|
15
|
+
// Internal ptr reference:
|
|
16
|
+
#ptr = null;
|
|
17
|
+
|
|
18
|
+
// Lifetimes are only to keep dependencies alive.
|
|
19
|
+
// Since JS won't garbage collect until there are no incoming edges.
|
|
20
|
+
#selfEdge = [];
|
|
21
|
+
|
|
22
|
+
#internalConstructor(symbol, ptr, selfEdge) {
|
|
23
|
+
if (symbol !== diplomatRuntime.internalConstructor) {
|
|
24
|
+
console.error("Schematic is an Opaque type. You cannot call its constructor.");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.#ptr = ptr;
|
|
28
|
+
this.#selfEdge = selfEdge;
|
|
29
|
+
|
|
30
|
+
// Are we being borrowed? If not, we can register.
|
|
31
|
+
if (this.#selfEdge.length === 0) {
|
|
32
|
+
Schematic_box_destroy_registry.register(this, this.#ptr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
get ffiValue() {
|
|
39
|
+
return this.#ptr;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create a new, empty schematic with the given name.
|
|
45
|
+
*/
|
|
46
|
+
static create(name) {
|
|
47
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
48
|
+
|
|
49
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
50
|
+
|
|
51
|
+
const result = wasm.Schematic_create(nameSlice.ptr);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
return new Schematic(diplomatRuntime.internalConstructor, result, []);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
finally {
|
|
58
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
59
|
+
functionCleanupArena.free();
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Release all block/entity storage immediately, keeping an empty valid
|
|
66
|
+
* schematic handle. JS consumers should call this when a parsed world or
|
|
67
|
+
* editing session is no longer needed instead of waiting for finalizers.
|
|
68
|
+
*/
|
|
69
|
+
clearContents() {
|
|
70
|
+
wasm.Schematic_clear_contents(this.ffiValue);
|
|
71
|
+
|
|
72
|
+
try {}
|
|
73
|
+
|
|
74
|
+
finally {
|
|
75
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Return an independent deep copy. Subsequent block, region, entity,
|
|
81
|
+
* metadata, or transform changes do not affect the original.
|
|
82
|
+
*/
|
|
83
|
+
deepClone() {
|
|
84
|
+
|
|
85
|
+
const result = wasm.Schematic_deep_clone(this.ffiValue);
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
return new Schematic(diplomatRuntime.internalConstructor, result, []);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
finally {
|
|
92
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Inspect a versioned transform-plan JSON document without modifying
|
|
98
|
+
* this schematic. Writes a deterministic audit-report JSON document.
|
|
99
|
+
*/
|
|
100
|
+
inspectTransformPlanJson(planJson) {
|
|
101
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
102
|
+
|
|
103
|
+
const planJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, planJson)));
|
|
104
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
105
|
+
|
|
106
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const result = wasm.Schematic_inspect_transform_plan_json(diplomatReceive.buffer, this.ffiValue, planJsonSlice.ptr, write.buffer);
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
if (!diplomatReceive.resultFlag) {
|
|
113
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
114
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
115
|
+
}
|
|
116
|
+
return write.readString8();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
finally {
|
|
120
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
121
|
+
functionCleanupArena.free();
|
|
122
|
+
|
|
123
|
+
diplomatReceive.free();
|
|
124
|
+
write.free();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Atomically apply a versioned transform-plan JSON document. Policy
|
|
130
|
+
* rejection is represented by `report.rejected == true` and leaves the
|
|
131
|
+
* schematic unchanged; malformed plans raise `InvalidArgument`.
|
|
132
|
+
*/
|
|
133
|
+
applyTransformPlanJson(planJson) {
|
|
134
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
135
|
+
|
|
136
|
+
const planJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, planJson)));
|
|
137
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
138
|
+
|
|
139
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
const result = wasm.Schematic_apply_transform_plan_json(diplomatReceive.buffer, this.ffiValue, planJsonSlice.ptr, write.buffer);
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
if (!diplomatReceive.resultFlag) {
|
|
146
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
147
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
148
|
+
}
|
|
149
|
+
return write.readString8();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
finally {
|
|
153
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
154
|
+
functionCleanupArena.free();
|
|
155
|
+
|
|
156
|
+
diplomatReceive.free();
|
|
157
|
+
write.free();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Apply the bundled deterministic, lossless canonicalization preset.
|
|
163
|
+
*/
|
|
164
|
+
canonicalizeJson() {
|
|
165
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
166
|
+
|
|
167
|
+
wasm.Schematic_canonicalize_json(this.ffiValue, write.buffer);
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
return write.readString8();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
finally {
|
|
174
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
175
|
+
write.free();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Inspect the bundled public-registry policy without modifying this
|
|
181
|
+
* schematic. Applications should review `rejected` and `quarantined`
|
|
182
|
+
* before choosing whether to call `apply_transform_plan_json`.
|
|
183
|
+
*/
|
|
184
|
+
inspectRegistrySafeJson() {
|
|
185
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
186
|
+
|
|
187
|
+
wasm.Schematic_inspect_registry_safe_json(this.ffiValue, write.buffer);
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
return write.readString8();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
finally {
|
|
194
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
195
|
+
write.free();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Split spatially independent machines while keeping nearby tiny
|
|
201
|
+
* detached parts with their machine. Components at least
|
|
202
|
+
* `min_standalone_blocks` large always remain independent; smaller
|
|
203
|
+
* components attach only directly to a core within `max_air_gap`.
|
|
204
|
+
* Attachment is non-transitive and the operation is lossless.
|
|
205
|
+
*/
|
|
206
|
+
splitConnectedAttachNearby(minStandaloneBlocks, maxAirGap) {
|
|
207
|
+
|
|
208
|
+
const result = wasm.Schematic_split_connected_attach_nearby(this.ffiValue, minStandaloneBlocks, maxAirGap);
|
|
209
|
+
|
|
210
|
+
try {
|
|
211
|
+
return new SchematicSplitResult(diplomatRuntime.internalConstructor, result, []);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
finally {
|
|
215
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The allocated dimensions (width, height, length) of the schematic's
|
|
221
|
+
* bounding box.
|
|
222
|
+
*/
|
|
223
|
+
dimensions() {
|
|
224
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 12, 4, false);
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
const result = wasm.Schematic_dimensions(diplomatReceive.buffer, this.ffiValue);
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
return Dimensions._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
finally {
|
|
234
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
235
|
+
diplomatReceive.free();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Returns `true` if a block was placed (out-of-range coordinates extend the
|
|
241
|
+
* schematic rather than erroring, matching `UniversalSchematic::set_block`).
|
|
242
|
+
*/
|
|
243
|
+
setBlock(x, y, z, blockName) {
|
|
244
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
245
|
+
|
|
246
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
247
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 1, true);
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
const result = wasm.Schematic_set_block(diplomatReceive.buffer, this.ffiValue, x, y, z, blockNameSlice.ptr);
|
|
251
|
+
|
|
252
|
+
try {
|
|
253
|
+
if (!diplomatReceive.resultFlag) {
|
|
254
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
255
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
256
|
+
}
|
|
257
|
+
return (new Uint8Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0] === 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
finally {
|
|
261
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
262
|
+
functionCleanupArena.free();
|
|
263
|
+
|
|
264
|
+
diplomatReceive.free();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The name of the block at a position. `NotFound` if the position is
|
|
270
|
+
* outside every region.
|
|
271
|
+
*/
|
|
272
|
+
getBlockName(x, y, z) {
|
|
273
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
274
|
+
|
|
275
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
const result = wasm.Schematic_get_block_name(diplomatReceive.buffer, this.ffiValue, x, y, z, write.buffer);
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
if (!diplomatReceive.resultFlag) {
|
|
282
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
283
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
284
|
+
}
|
|
285
|
+
return write.readString8();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
finally {
|
|
289
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
290
|
+
diplomatReceive.free();
|
|
291
|
+
write.free();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Build a schematic from raw byte data, auto-detecting the format.
|
|
297
|
+
* Supports Litematic, Sponge Schematic, and McStructure (Bedrock) formats.
|
|
298
|
+
* `Parse` if a format was detected but failed to parse, `InvalidArgument` if
|
|
299
|
+
* no format was recognized.
|
|
300
|
+
*/
|
|
301
|
+
static fromData(data) {
|
|
302
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
303
|
+
|
|
304
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
305
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
const result = wasm.Schematic_from_data(diplomatReceive.buffer, dataSlice.ptr);
|
|
309
|
+
|
|
310
|
+
try {
|
|
311
|
+
if (!diplomatReceive.resultFlag) {
|
|
312
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
313
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
314
|
+
}
|
|
315
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
finally {
|
|
319
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
320
|
+
functionCleanupArena.free();
|
|
321
|
+
|
|
322
|
+
diplomatReceive.free();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Decode untrusted bytes using a serialized `DecodeLimits` object.
|
|
328
|
+
* Empty JSON selects the conservative library defaults. Limits are
|
|
329
|
+
* enforced while decompressing/parsing and again before region
|
|
330
|
+
* allocations are accepted.
|
|
331
|
+
*/
|
|
332
|
+
static fromDataBounded(data, limitsJson) {
|
|
333
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
334
|
+
|
|
335
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
336
|
+
const limitsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, limitsJson)));
|
|
337
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
const result = wasm.Schematic_from_data_bounded(diplomatReceive.buffer, dataSlice.ptr, limitsJsonSlice.ptr);
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
if (!diplomatReceive.resultFlag) {
|
|
344
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
345
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
346
|
+
}
|
|
347
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
finally {
|
|
351
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
352
|
+
functionCleanupArena.free();
|
|
353
|
+
|
|
354
|
+
diplomatReceive.free();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Build a schematic from Litematic data.
|
|
360
|
+
*/
|
|
361
|
+
static fromLitematic(data) {
|
|
362
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
363
|
+
|
|
364
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
365
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
const result = wasm.Schematic_from_litematic(diplomatReceive.buffer, dataSlice.ptr);
|
|
369
|
+
|
|
370
|
+
try {
|
|
371
|
+
if (!diplomatReceive.resultFlag) {
|
|
372
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
373
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
374
|
+
}
|
|
375
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
finally {
|
|
379
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
380
|
+
functionCleanupArena.free();
|
|
381
|
+
|
|
382
|
+
diplomatReceive.free();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* The schematic as Litematic bytes, base64-encoded.
|
|
388
|
+
*/
|
|
389
|
+
toLitematicB64() {
|
|
390
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
391
|
+
|
|
392
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
const result = wasm.Schematic_to_litematic_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
396
|
+
|
|
397
|
+
try {
|
|
398
|
+
if (!diplomatReceive.resultFlag) {
|
|
399
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
400
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
401
|
+
}
|
|
402
|
+
return write.readString8();
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
finally {
|
|
406
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
407
|
+
diplomatReceive.free();
|
|
408
|
+
write.free();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Build a schematic from classic `.schematic` data.
|
|
414
|
+
*/
|
|
415
|
+
static fromSchematic(data) {
|
|
416
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
417
|
+
|
|
418
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
419
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
const result = wasm.Schematic_from_schematic(diplomatReceive.buffer, dataSlice.ptr);
|
|
423
|
+
|
|
424
|
+
try {
|
|
425
|
+
if (!diplomatReceive.resultFlag) {
|
|
426
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
427
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
428
|
+
}
|
|
429
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
finally {
|
|
433
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
434
|
+
functionCleanupArena.free();
|
|
435
|
+
|
|
436
|
+
diplomatReceive.free();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* The schematic as classic `.schematic` bytes, base64-encoded.
|
|
442
|
+
*/
|
|
443
|
+
toSchematicB64() {
|
|
444
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
445
|
+
|
|
446
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
const result = wasm.Schematic_to_schematic_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
450
|
+
|
|
451
|
+
try {
|
|
452
|
+
if (!diplomatReceive.resultFlag) {
|
|
453
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
454
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
455
|
+
}
|
|
456
|
+
return write.readString8();
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
finally {
|
|
460
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
461
|
+
diplomatReceive.free();
|
|
462
|
+
write.free();
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Build a schematic from snapshot (fast binary) data.
|
|
468
|
+
*/
|
|
469
|
+
static fromSnapshot(data) {
|
|
470
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
471
|
+
|
|
472
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
473
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
const result = wasm.Schematic_from_snapshot(diplomatReceive.buffer, dataSlice.ptr);
|
|
477
|
+
|
|
478
|
+
try {
|
|
479
|
+
if (!diplomatReceive.resultFlag) {
|
|
480
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
481
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
482
|
+
}
|
|
483
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
finally {
|
|
487
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
488
|
+
functionCleanupArena.free();
|
|
489
|
+
|
|
490
|
+
diplomatReceive.free();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* The schematic as snapshot (fast binary) bytes, base64-encoded.
|
|
496
|
+
*/
|
|
497
|
+
toSnapshotB64() {
|
|
498
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
499
|
+
|
|
500
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
const result = wasm.Schematic_to_snapshot_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
504
|
+
|
|
505
|
+
try {
|
|
506
|
+
if (!diplomatReceive.resultFlag) {
|
|
507
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
508
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
509
|
+
}
|
|
510
|
+
return write.readString8();
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
finally {
|
|
514
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
515
|
+
diplomatReceive.free();
|
|
516
|
+
write.free();
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Build a schematic from McStructure (Bedrock) data.
|
|
522
|
+
*/
|
|
523
|
+
static fromMcstructure(data) {
|
|
524
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
525
|
+
|
|
526
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
527
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
const result = wasm.Schematic_from_mcstructure(diplomatReceive.buffer, dataSlice.ptr);
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
if (!diplomatReceive.resultFlag) {
|
|
534
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
535
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
536
|
+
}
|
|
537
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
finally {
|
|
541
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
542
|
+
functionCleanupArena.free();
|
|
543
|
+
|
|
544
|
+
diplomatReceive.free();
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* The schematic as McStructure (Bedrock) bytes, base64-encoded.
|
|
550
|
+
*/
|
|
551
|
+
toMcstructureB64() {
|
|
552
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
553
|
+
|
|
554
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
const result = wasm.Schematic_to_mcstructure_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
558
|
+
|
|
559
|
+
try {
|
|
560
|
+
if (!diplomatReceive.resultFlag) {
|
|
561
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
562
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
563
|
+
}
|
|
564
|
+
return write.readString8();
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
finally {
|
|
568
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
569
|
+
diplomatReceive.free();
|
|
570
|
+
write.free();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Import from a single MCA region file.
|
|
576
|
+
*/
|
|
577
|
+
static fromMca(data) {
|
|
578
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
579
|
+
|
|
580
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
581
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
const result = wasm.Schematic_from_mca(diplomatReceive.buffer, dataSlice.ptr);
|
|
585
|
+
|
|
586
|
+
try {
|
|
587
|
+
if (!diplomatReceive.resultFlag) {
|
|
588
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
589
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
590
|
+
}
|
|
591
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
finally {
|
|
595
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
596
|
+
functionCleanupArena.free();
|
|
597
|
+
|
|
598
|
+
diplomatReceive.free();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Import from MCA with coordinate bounds.
|
|
604
|
+
*/
|
|
605
|
+
static fromMcaBounded(data, minX, minY, minZ, maxX, maxY, maxZ) {
|
|
606
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
607
|
+
|
|
608
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
609
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
const result = wasm.Schematic_from_mca_bounded(diplomatReceive.buffer, dataSlice.ptr, minX, minY, minZ, maxX, maxY, maxZ);
|
|
613
|
+
|
|
614
|
+
try {
|
|
615
|
+
if (!diplomatReceive.resultFlag) {
|
|
616
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
617
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
618
|
+
}
|
|
619
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
finally {
|
|
623
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
624
|
+
functionCleanupArena.free();
|
|
625
|
+
|
|
626
|
+
diplomatReceive.free();
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Import from a zipped world folder.
|
|
632
|
+
*/
|
|
633
|
+
static fromWorldZip(data) {
|
|
634
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
635
|
+
|
|
636
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
637
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
const result = wasm.Schematic_from_world_zip(diplomatReceive.buffer, dataSlice.ptr);
|
|
641
|
+
|
|
642
|
+
try {
|
|
643
|
+
if (!diplomatReceive.resultFlag) {
|
|
644
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
645
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
646
|
+
}
|
|
647
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
finally {
|
|
651
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
652
|
+
functionCleanupArena.free();
|
|
653
|
+
|
|
654
|
+
diplomatReceive.free();
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Import from zipped world with coordinate bounds.
|
|
660
|
+
*/
|
|
661
|
+
static fromWorldZipBounded(data, minX, minY, minZ, maxX, maxY, maxZ) {
|
|
662
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
663
|
+
|
|
664
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
665
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
const result = wasm.Schematic_from_world_zip_bounded(diplomatReceive.buffer, dataSlice.ptr, minX, minY, minZ, maxX, maxY, maxZ);
|
|
669
|
+
|
|
670
|
+
try {
|
|
671
|
+
if (!diplomatReceive.resultFlag) {
|
|
672
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
673
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
674
|
+
}
|
|
675
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
finally {
|
|
679
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
680
|
+
functionCleanupArena.free();
|
|
681
|
+
|
|
682
|
+
diplomatReceive.free();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Import from a Minecraft world directory path.
|
|
688
|
+
*/
|
|
689
|
+
static fromWorldDirectory(path) {
|
|
690
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
691
|
+
|
|
692
|
+
const pathSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, path)));
|
|
693
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
const result = wasm.Schematic_from_world_directory(diplomatReceive.buffer, pathSlice.ptr);
|
|
697
|
+
|
|
698
|
+
try {
|
|
699
|
+
if (!diplomatReceive.resultFlag) {
|
|
700
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
701
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
702
|
+
}
|
|
703
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
finally {
|
|
707
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
708
|
+
functionCleanupArena.free();
|
|
709
|
+
|
|
710
|
+
diplomatReceive.free();
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Import from world directory with coordinate bounds.
|
|
716
|
+
*/
|
|
717
|
+
static fromWorldDirectoryBounded(path, minX, minY, minZ, maxX, maxY, maxZ) {
|
|
718
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
719
|
+
|
|
720
|
+
const pathSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, path)));
|
|
721
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
const result = wasm.Schematic_from_world_directory_bounded(diplomatReceive.buffer, pathSlice.ptr, minX, minY, minZ, maxX, maxY, maxZ);
|
|
725
|
+
|
|
726
|
+
try {
|
|
727
|
+
if (!diplomatReceive.resultFlag) {
|
|
728
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
729
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
730
|
+
}
|
|
731
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
finally {
|
|
735
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
736
|
+
functionCleanupArena.free();
|
|
737
|
+
|
|
738
|
+
diplomatReceive.free();
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Export the schematic as a Minecraft world: a JSON array of
|
|
744
|
+
* `{"path": <relative file path>, "data_b64": <base64 bytes>}` entries
|
|
745
|
+
* (the old `CFileMap`). `options_json` may be empty for defaults.
|
|
746
|
+
*/
|
|
747
|
+
toWorldJson(optionsJson) {
|
|
748
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
749
|
+
|
|
750
|
+
const optionsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, optionsJson)));
|
|
751
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
752
|
+
|
|
753
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
const result = wasm.Schematic_to_world_json(diplomatReceive.buffer, this.ffiValue, optionsJsonSlice.ptr, write.buffer);
|
|
757
|
+
|
|
758
|
+
try {
|
|
759
|
+
if (!diplomatReceive.resultFlag) {
|
|
760
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
761
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
762
|
+
}
|
|
763
|
+
return write.readString8();
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
finally {
|
|
767
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
768
|
+
functionCleanupArena.free();
|
|
769
|
+
|
|
770
|
+
diplomatReceive.free();
|
|
771
|
+
write.free();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Export and write world files to a directory. `options_json` may be empty.
|
|
777
|
+
*/
|
|
778
|
+
saveWorld(directory, optionsJson) {
|
|
779
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
780
|
+
|
|
781
|
+
const directorySlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, directory)));
|
|
782
|
+
const optionsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, optionsJson)));
|
|
783
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
const result = wasm.Schematic_save_world(diplomatReceive.buffer, this.ffiValue, directorySlice.ptr, optionsJsonSlice.ptr);
|
|
787
|
+
|
|
788
|
+
try {
|
|
789
|
+
if (!diplomatReceive.resultFlag) {
|
|
790
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
791
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
finally {
|
|
796
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
797
|
+
functionCleanupArena.free();
|
|
798
|
+
|
|
799
|
+
diplomatReceive.free();
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Export the schematic as a zipped Minecraft world, base64-encoded.
|
|
805
|
+
* `options_json` may be empty for defaults.
|
|
806
|
+
*/
|
|
807
|
+
toWorldZipB64(optionsJson) {
|
|
808
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
809
|
+
|
|
810
|
+
const optionsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, optionsJson)));
|
|
811
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
812
|
+
|
|
813
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
const result = wasm.Schematic_to_world_zip_b64(diplomatReceive.buffer, this.ffiValue, optionsJsonSlice.ptr, write.buffer);
|
|
817
|
+
|
|
818
|
+
try {
|
|
819
|
+
if (!diplomatReceive.resultFlag) {
|
|
820
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
821
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
822
|
+
}
|
|
823
|
+
return write.readString8();
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
finally {
|
|
827
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
828
|
+
functionCleanupArena.free();
|
|
829
|
+
|
|
830
|
+
diplomatReceive.free();
|
|
831
|
+
write.free();
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Set a block with properties given as a JSON object of string→string
|
|
837
|
+
* (the old `CProperty` array).
|
|
838
|
+
*/
|
|
839
|
+
setBlockWithProperties(x, y, z, blockName, propertiesJson) {
|
|
840
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
841
|
+
|
|
842
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
843
|
+
const propertiesJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, propertiesJson)));
|
|
844
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
const result = wasm.Schematic_set_block_with_properties(diplomatReceive.buffer, this.ffiValue, x, y, z, blockNameSlice.ptr, propertiesJsonSlice.ptr);
|
|
848
|
+
|
|
849
|
+
try {
|
|
850
|
+
if (!diplomatReceive.resultFlag) {
|
|
851
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
852
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
finally {
|
|
857
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
858
|
+
functionCleanupArena.free();
|
|
859
|
+
|
|
860
|
+
diplomatReceive.free();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Set a block from a full block string, e.g.
|
|
866
|
+
* `minecraft:chest[facing=north]{Items:[...]}`.
|
|
867
|
+
*/
|
|
868
|
+
setBlockFromString(x, y, z, blockString) {
|
|
869
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
870
|
+
|
|
871
|
+
const blockStringSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockString)));
|
|
872
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
const result = wasm.Schematic_set_block_from_string(diplomatReceive.buffer, this.ffiValue, x, y, z, blockStringSlice.ptr);
|
|
876
|
+
|
|
877
|
+
try {
|
|
878
|
+
if (!diplomatReceive.resultFlag) {
|
|
879
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
880
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
finally {
|
|
885
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
886
|
+
functionCleanupArena.free();
|
|
887
|
+
|
|
888
|
+
diplomatReceive.free();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Pre-resolve a plain block name to a palette index for use with `place`.
|
|
894
|
+
* Pair them in hot loops with many unique block names to skip the per-call
|
|
895
|
+
* name → palette lookup.
|
|
896
|
+
*/
|
|
897
|
+
prepareBlock(blockName) {
|
|
898
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
899
|
+
|
|
900
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
901
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
const result = wasm.Schematic_prepare_block(diplomatReceive.buffer, this.ffiValue, blockNameSlice.ptr);
|
|
905
|
+
|
|
906
|
+
try {
|
|
907
|
+
if (!diplomatReceive.resultFlag) {
|
|
908
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
909
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
910
|
+
}
|
|
911
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
finally {
|
|
915
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
916
|
+
functionCleanupArena.free();
|
|
917
|
+
|
|
918
|
+
diplomatReceive.free();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Place a block by pre-resolved palette index (from `prepare_block`).
|
|
924
|
+
*/
|
|
925
|
+
place(x, y, z, paletteIndex) {
|
|
926
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
const result = wasm.Schematic_place(diplomatReceive.buffer, this.ffiValue, x, y, z, paletteIndex);
|
|
930
|
+
|
|
931
|
+
try {
|
|
932
|
+
if (!diplomatReceive.resultFlag) {
|
|
933
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
934
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
finally {
|
|
939
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
940
|
+
diplomatReceive.free();
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Batch-set blocks at multiple positions to the same block (name, block
|
|
946
|
+
* string with properties, or block string with NBT). `positions` is flat
|
|
947
|
+
* `[x0,y0,z0, x1,y1,z1, ...]` (length must be a multiple of 3).
|
|
948
|
+
* Returns the number of blocks set.
|
|
949
|
+
*/
|
|
950
|
+
setBlocks(positions, blockName) {
|
|
951
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
952
|
+
|
|
953
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
954
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
955
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
const result = wasm.Schematic_set_blocks(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, blockNameSlice.ptr);
|
|
959
|
+
|
|
960
|
+
try {
|
|
961
|
+
if (!diplomatReceive.resultFlag) {
|
|
962
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
963
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
964
|
+
}
|
|
965
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
finally {
|
|
969
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
970
|
+
functionCleanupArena.free();
|
|
971
|
+
|
|
972
|
+
diplomatReceive.free();
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Sequentially hand-place the same block at many positions in one
|
|
978
|
+
* local simulated component. `positions` is flat
|
|
979
|
+
* `[x0,y0,z0, x1,y1,z1, ...]`; placements run in that order and each
|
|
980
|
+
* settles before the next. Returns the number of final cells written
|
|
981
|
+
* back, including neighbours changed by redstone or pistons.
|
|
982
|
+
*
|
|
983
|
+
* Nearby passive blocks are loaded as environmental context, but the
|
|
984
|
+
* write-back is confined to the active component's effect window. Its
|
|
985
|
+
* runtime is therefore independent of unrelated schematic volume.
|
|
986
|
+
* Use `set_blocks_simulated_full_world` to opt into global updates.
|
|
987
|
+
*
|
|
988
|
+
* This is the efficient bulk form of repeated `{simulate=true}`:
|
|
989
|
+
* structure conversion and simulator wiring happen once for the
|
|
990
|
+
* complete sequence. Propagation is not constant-time—a placement can
|
|
991
|
+
* affect an arbitrarily large circuit—but fixed setup is amortized.
|
|
992
|
+
*/
|
|
993
|
+
setBlocksSimulated(positions, blockName) {
|
|
994
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
995
|
+
|
|
996
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
997
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
998
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
const result = wasm.Schematic_set_blocks_simulated(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, blockNameSlice.ptr);
|
|
1002
|
+
|
|
1003
|
+
try {
|
|
1004
|
+
if (!diplomatReceive.resultFlag) {
|
|
1005
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1006
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1007
|
+
}
|
|
1008
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
finally {
|
|
1012
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1013
|
+
functionCleanupArena.free();
|
|
1014
|
+
|
|
1015
|
+
diplomatReceive.free();
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Explicit full-world counterpart to `set_blocks_simulated`.
|
|
1021
|
+
* Unrelated schematic volume participates in setup and any resulting
|
|
1022
|
+
* changes anywhere in the loaded world are written back.
|
|
1023
|
+
*/
|
|
1024
|
+
setBlocksSimulatedFullWorld(positions, blockName) {
|
|
1025
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1026
|
+
|
|
1027
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
1028
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
1029
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
const result = wasm.Schematic_set_blocks_simulated_full_world(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, blockNameSlice.ptr);
|
|
1033
|
+
|
|
1034
|
+
try {
|
|
1035
|
+
if (!diplomatReceive.resultFlag) {
|
|
1036
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1037
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1038
|
+
}
|
|
1039
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
finally {
|
|
1043
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1044
|
+
functionCleanupArena.free();
|
|
1045
|
+
|
|
1046
|
+
diplomatReceive.free();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Batch-get block names at multiple positions. `positions` is flat
|
|
1052
|
+
* `[x0,y0,z0, ...]` (length must be a multiple of 3). Writes a JSON array,
|
|
1053
|
+
* one entry per position: the block name string, or `null` for
|
|
1054
|
+
* empty/out-of-bounds positions.
|
|
1055
|
+
*/
|
|
1056
|
+
getBlocksJson(positions) {
|
|
1057
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1058
|
+
|
|
1059
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
1060
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1061
|
+
|
|
1062
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
const result = wasm.Schematic_get_blocks_json(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, write.buffer);
|
|
1066
|
+
|
|
1067
|
+
try {
|
|
1068
|
+
if (!diplomatReceive.resultFlag) {
|
|
1069
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1070
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1071
|
+
}
|
|
1072
|
+
return write.readString8();
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
finally {
|
|
1076
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1077
|
+
functionCleanupArena.free();
|
|
1078
|
+
|
|
1079
|
+
diplomatReceive.free();
|
|
1080
|
+
write.free();
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Stamp a merged source box into the default region. Excluded blocks
|
|
1086
|
+
* are skipped, preserving destination content. Empty string or `[]`
|
|
1087
|
+
* means no exclusions.
|
|
1088
|
+
*/
|
|
1089
|
+
stampBox(source, minX, minY, minZ, maxX, maxY, maxZ, targetX, targetY, targetZ, excludedBlocksJson) {
|
|
1090
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1091
|
+
|
|
1092
|
+
const excludedBlocksJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, excludedBlocksJson)));
|
|
1093
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
const result = wasm.Schematic_stamp_box(diplomatReceive.buffer, this.ffiValue, source.ffiValue, minX, minY, minZ, maxX, maxY, maxZ, targetX, targetY, targetZ, excludedBlocksJsonSlice.ptr);
|
|
1097
|
+
|
|
1098
|
+
try {
|
|
1099
|
+
if (!diplomatReceive.resultFlag) {
|
|
1100
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1101
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
finally {
|
|
1106
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1107
|
+
functionCleanupArena.free();
|
|
1108
|
+
|
|
1109
|
+
diplomatReceive.free();
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Stamp one explicitly named source region into the default region.
|
|
1115
|
+
* The region's minimum corner is mapped to the target position.
|
|
1116
|
+
*/
|
|
1117
|
+
stampRegion(source, sourceRegionName, targetX, targetY, targetZ, excludedBlocksJson) {
|
|
1118
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1119
|
+
|
|
1120
|
+
const sourceRegionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, sourceRegionName)));
|
|
1121
|
+
const excludedBlocksJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, excludedBlocksJson)));
|
|
1122
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
const result = wasm.Schematic_stamp_region(diplomatReceive.buffer, this.ffiValue, source.ffiValue, sourceRegionNameSlice.ptr, targetX, targetY, targetZ, excludedBlocksJsonSlice.ptr);
|
|
1126
|
+
|
|
1127
|
+
try {
|
|
1128
|
+
if (!diplomatReceive.resultFlag) {
|
|
1129
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1130
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
finally {
|
|
1135
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1136
|
+
functionCleanupArena.free();
|
|
1137
|
+
|
|
1138
|
+
diplomatReceive.free();
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Compatibility alias for `stamp_box`.
|
|
1144
|
+
*/
|
|
1145
|
+
copyRegion(source, minX, minY, minZ, maxX, maxY, maxZ, targetX, targetY, targetZ, excludedBlocksJson) {
|
|
1146
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1147
|
+
|
|
1148
|
+
const excludedBlocksJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, excludedBlocksJson)));
|
|
1149
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
const result = wasm.Schematic_copy_region(diplomatReceive.buffer, this.ffiValue, source.ffiValue, minX, minY, minZ, maxX, maxY, maxZ, targetX, targetY, targetZ, excludedBlocksJsonSlice.ptr);
|
|
1153
|
+
|
|
1154
|
+
try {
|
|
1155
|
+
if (!diplomatReceive.resultFlag) {
|
|
1156
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1157
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
finally {
|
|
1162
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1163
|
+
functionCleanupArena.free();
|
|
1164
|
+
|
|
1165
|
+
diplomatReceive.free();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* The full block state at a position. `NotFound` if the position is
|
|
1171
|
+
* outside every region.
|
|
1172
|
+
*/
|
|
1173
|
+
getBlock(x, y, z) {
|
|
1174
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
const result = wasm.Schematic_get_block(diplomatReceive.buffer, this.ffiValue, x, y, z);
|
|
1178
|
+
|
|
1179
|
+
try {
|
|
1180
|
+
if (!diplomatReceive.resultFlag) {
|
|
1181
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1182
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1183
|
+
}
|
|
1184
|
+
return new BlockState(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
finally {
|
|
1188
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1189
|
+
diplomatReceive.free();
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* The block at a position with its properties, as a `BlockState`.
|
|
1195
|
+
* Kept as an explicit alias for callers migrating from the older API.
|
|
1196
|
+
*/
|
|
1197
|
+
getBlockWithProperties(x, y, z) {
|
|
1198
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
const result = wasm.Schematic_get_block_with_properties(diplomatReceive.buffer, this.ffiValue, x, y, z);
|
|
1202
|
+
|
|
1203
|
+
try {
|
|
1204
|
+
if (!diplomatReceive.resultFlag) {
|
|
1205
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1206
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1207
|
+
}
|
|
1208
|
+
return new BlockState(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
finally {
|
|
1212
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1213
|
+
diplomatReceive.free();
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* The full block state at a position in one specific region. This
|
|
1219
|
+
* avoids composite lookup ambiguity when regions overlap.
|
|
1220
|
+
*/
|
|
1221
|
+
getBlockInRegion(regionName, x, y, z) {
|
|
1222
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1223
|
+
|
|
1224
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
1225
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
const result = wasm.Schematic_get_block_in_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, x, y, z);
|
|
1229
|
+
|
|
1230
|
+
try {
|
|
1231
|
+
if (!diplomatReceive.resultFlag) {
|
|
1232
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1233
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1234
|
+
}
|
|
1235
|
+
return new BlockState(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
finally {
|
|
1239
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1240
|
+
functionCleanupArena.free();
|
|
1241
|
+
|
|
1242
|
+
diplomatReceive.free();
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* The block string at a position in one specific region.
|
|
1248
|
+
*/
|
|
1249
|
+
getBlockStringInRegion(regionName, x, y, z) {
|
|
1250
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1251
|
+
|
|
1252
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
1253
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1254
|
+
|
|
1255
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
const result = wasm.Schematic_get_block_string_in_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, x, y, z, write.buffer);
|
|
1259
|
+
|
|
1260
|
+
try {
|
|
1261
|
+
if (!diplomatReceive.resultFlag) {
|
|
1262
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1263
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1264
|
+
}
|
|
1265
|
+
return write.readString8();
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
finally {
|
|
1269
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1270
|
+
functionCleanupArena.free();
|
|
1271
|
+
|
|
1272
|
+
diplomatReceive.free();
|
|
1273
|
+
write.free();
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* The full block string (name, properties, NBT) at a position.
|
|
1279
|
+
*/
|
|
1280
|
+
getBlockString(x, y, z) {
|
|
1281
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1282
|
+
|
|
1283
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
const result = wasm.Schematic_get_block_string(diplomatReceive.buffer, this.ffiValue, x, y, z, write.buffer);
|
|
1287
|
+
|
|
1288
|
+
try {
|
|
1289
|
+
if (!diplomatReceive.resultFlag) {
|
|
1290
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1291
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1292
|
+
}
|
|
1293
|
+
return write.readString8();
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
finally {
|
|
1297
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1298
|
+
diplomatReceive.free();
|
|
1299
|
+
write.free();
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* The block entity at a position as JSON
|
|
1305
|
+
* `{"id": ..., "position": [x,y,z], "nbt": {...}}` (the old `CBlockEntity`).
|
|
1306
|
+
*/
|
|
1307
|
+
getBlockEntityJson(x, y, z) {
|
|
1308
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1309
|
+
|
|
1310
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
const result = wasm.Schematic_get_block_entity_json(diplomatReceive.buffer, this.ffiValue, x, y, z, write.buffer);
|
|
1314
|
+
|
|
1315
|
+
try {
|
|
1316
|
+
if (!diplomatReceive.resultFlag) {
|
|
1317
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1318
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1319
|
+
}
|
|
1320
|
+
return write.readString8();
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
finally {
|
|
1324
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1325
|
+
diplomatReceive.free();
|
|
1326
|
+
write.free();
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* The block entity at a position in one specific region as JSON.
|
|
1332
|
+
*/
|
|
1333
|
+
getBlockEntityJsonInRegion(regionName, x, y, z) {
|
|
1334
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1335
|
+
|
|
1336
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
1337
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1338
|
+
|
|
1339
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
const result = wasm.Schematic_get_block_entity_json_in_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, x, y, z, write.buffer);
|
|
1343
|
+
|
|
1344
|
+
try {
|
|
1345
|
+
if (!diplomatReceive.resultFlag) {
|
|
1346
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1347
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1348
|
+
}
|
|
1349
|
+
return write.readString8();
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
finally {
|
|
1353
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1354
|
+
functionCleanupArena.free();
|
|
1355
|
+
|
|
1356
|
+
diplomatReceive.free();
|
|
1357
|
+
write.free();
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Every block entity as a JSON array of
|
|
1363
|
+
* `{"id": ..., "position": [x,y,z], "nbt": {...}}`.
|
|
1364
|
+
*/
|
|
1365
|
+
getAllBlockEntitiesJson() {
|
|
1366
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1367
|
+
|
|
1368
|
+
wasm.Schematic_get_all_block_entities_json(this.ffiValue, write.buffer);
|
|
1369
|
+
|
|
1370
|
+
try {
|
|
1371
|
+
return write.readString8();
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
finally {
|
|
1375
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1376
|
+
write.free();
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* The number of mobile entities (not block entities).
|
|
1382
|
+
*/
|
|
1383
|
+
entityCount() {
|
|
1384
|
+
|
|
1385
|
+
const result = wasm.Schematic_entity_count(this.ffiValue);
|
|
1386
|
+
|
|
1387
|
+
try {
|
|
1388
|
+
return result;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
finally {
|
|
1392
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Every mobile entity as a JSON array of
|
|
1398
|
+
* `{"id": ..., "position": [x,y,z], "nbt": {...}}` (the old `CEntityArray`).
|
|
1399
|
+
*/
|
|
1400
|
+
getEntitiesJson() {
|
|
1401
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1402
|
+
|
|
1403
|
+
wasm.Schematic_get_entities_json(this.ffiValue, write.buffer);
|
|
1404
|
+
|
|
1405
|
+
try {
|
|
1406
|
+
return write.readString8();
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
finally {
|
|
1410
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1411
|
+
write.free();
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Add a mobile entity. `nbt_json` is a JSON object (may be empty).
|
|
1417
|
+
*/
|
|
1418
|
+
addEntity(id, x, y, z, nbtJson) {
|
|
1419
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1420
|
+
|
|
1421
|
+
const idSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, id)));
|
|
1422
|
+
const nbtJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, nbtJson)));
|
|
1423
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
const result = wasm.Schematic_add_entity(diplomatReceive.buffer, this.ffiValue, idSlice.ptr, x, y, z, nbtJsonSlice.ptr);
|
|
1427
|
+
|
|
1428
|
+
try {
|
|
1429
|
+
if (!diplomatReceive.resultFlag) {
|
|
1430
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1431
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
finally {
|
|
1436
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1437
|
+
functionCleanupArena.free();
|
|
1438
|
+
|
|
1439
|
+
diplomatReceive.free();
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Add an armor stand without hand-authoring entity NBT.
|
|
1445
|
+
*
|
|
1446
|
+
* `armor_material` accepts `diamond`, `netherite`, `iron`, etc.; an
|
|
1447
|
+
* empty string creates an unarmored stand. `yaw` uses Minecraft degrees.
|
|
1448
|
+
*/
|
|
1449
|
+
addArmorStand(x, y, z, yaw, armorMaterial) {
|
|
1450
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1451
|
+
|
|
1452
|
+
const armorMaterialSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, armorMaterial)));
|
|
1453
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
const result = wasm.Schematic_add_armor_stand(diplomatReceive.buffer, this.ffiValue, x, y, z, yaw, armorMaterialSlice.ptr);
|
|
1457
|
+
|
|
1458
|
+
try {
|
|
1459
|
+
if (!diplomatReceive.resultFlag) {
|
|
1460
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1461
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
finally {
|
|
1466
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1467
|
+
functionCleanupArena.free();
|
|
1468
|
+
|
|
1469
|
+
diplomatReceive.free();
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Remove a mobile entity by index.
|
|
1475
|
+
*/
|
|
1476
|
+
removeEntity(index) {
|
|
1477
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
const result = wasm.Schematic_remove_entity(diplomatReceive.buffer, this.ffiValue, index);
|
|
1481
|
+
|
|
1482
|
+
try {
|
|
1483
|
+
if (!diplomatReceive.resultFlag) {
|
|
1484
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1485
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
finally {
|
|
1490
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1491
|
+
diplomatReceive.free();
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* The canonical in-memory data version (the forward-conversion target).
|
|
1497
|
+
*/
|
|
1498
|
+
static canonicalDataVersion() {
|
|
1499
|
+
|
|
1500
|
+
const result = wasm.Schematic_canonical_data_version();
|
|
1501
|
+
|
|
1502
|
+
try {
|
|
1503
|
+
return result;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
finally {
|
|
1507
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Convert block/item/entity data between Minecraft data versions. Forward
|
|
1513
|
+
* (`target >= source`) is lossless; reverse is lossy. Writes a JSON loss
|
|
1514
|
+
* report (`[]` when lossless).
|
|
1515
|
+
*/
|
|
1516
|
+
convertToDataVersion(targetDataVersion, sourceDataVersion) {
|
|
1517
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1518
|
+
|
|
1519
|
+
wasm.Schematic_convert_to_data_version(this.ffiValue, targetDataVersion, sourceDataVersion, write.buffer);
|
|
1520
|
+
|
|
1521
|
+
try {
|
|
1522
|
+
return write.readString8();
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
finally {
|
|
1526
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1527
|
+
write.free();
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* Convert to `target_data_version` using the schematic's captured source
|
|
1533
|
+
* version (else `mc_version`, else canonical) as origin, updating metadata
|
|
1534
|
+
* to the target. Writes a JSON loss report (`[]` when lossless).
|
|
1535
|
+
*/
|
|
1536
|
+
convertToVersion(targetDataVersion) {
|
|
1537
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1538
|
+
|
|
1539
|
+
wasm.Schematic_convert_to_version(this.ffiValue, targetDataVersion, write.buffer);
|
|
1540
|
+
|
|
1541
|
+
try {
|
|
1542
|
+
return write.readString8();
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
finally {
|
|
1546
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1547
|
+
write.free();
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* The Minecraft data version of the file this schematic was loaded from, or
|
|
1553
|
+
* `-1` if none was captured (versionless / freshly built).
|
|
1554
|
+
*/
|
|
1555
|
+
sourceDataVersion() {
|
|
1556
|
+
|
|
1557
|
+
const result = wasm.Schematic_source_data_version(this.ffiValue);
|
|
1558
|
+
|
|
1559
|
+
try {
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
finally {
|
|
1564
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Override the source data version for formats that carry no Java data
|
|
1570
|
+
* version, so the converter knows what to convert *from*.
|
|
1571
|
+
*/
|
|
1572
|
+
setSourceDataVersion(version) {
|
|
1573
|
+
wasm.Schematic_set_source_data_version(this.ffiValue, version);
|
|
1574
|
+
|
|
1575
|
+
try {}
|
|
1576
|
+
|
|
1577
|
+
finally {
|
|
1578
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Serialize a `.litematic` targeting a specific Minecraft data version. A
|
|
1584
|
+
* COPY is converted and the matching Version header written; the schematic
|
|
1585
|
+
* is left unchanged. Writes JSON
|
|
1586
|
+
* `{"data_b64": <base64 .litematic>, "loss": <loss report>}`.
|
|
1587
|
+
*/
|
|
1588
|
+
toLitematicForVersionJson(targetDataVersion) {
|
|
1589
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1590
|
+
|
|
1591
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
const result = wasm.Schematic_to_litematic_for_version_json(diplomatReceive.buffer, this.ffiValue, targetDataVersion, write.buffer);
|
|
1595
|
+
|
|
1596
|
+
try {
|
|
1597
|
+
if (!diplomatReceive.resultFlag) {
|
|
1598
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1599
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1600
|
+
}
|
|
1601
|
+
return write.readString8();
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
finally {
|
|
1605
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1606
|
+
diplomatReceive.free();
|
|
1607
|
+
write.free();
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* The block entity's NBT as a typed SNBT string. Round-trips losslessly.
|
|
1613
|
+
*/
|
|
1614
|
+
getBlockEntitySnbt(x, y, z) {
|
|
1615
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1616
|
+
|
|
1617
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
const result = wasm.Schematic_get_block_entity_snbt(diplomatReceive.buffer, this.ffiValue, x, y, z, write.buffer);
|
|
1621
|
+
|
|
1622
|
+
try {
|
|
1623
|
+
if (!diplomatReceive.resultFlag) {
|
|
1624
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1625
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1626
|
+
}
|
|
1627
|
+
return write.readString8();
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
finally {
|
|
1631
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1632
|
+
diplomatReceive.free();
|
|
1633
|
+
write.free();
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* Set (or replace) a block entity at a position from a typed SNBT string.
|
|
1639
|
+
*/
|
|
1640
|
+
setBlockEntity(x, y, z, id, snbt) {
|
|
1641
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1642
|
+
|
|
1643
|
+
const idSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, id)));
|
|
1644
|
+
const snbtSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, snbt)));
|
|
1645
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
const result = wasm.Schematic_set_block_entity(diplomatReceive.buffer, this.ffiValue, x, y, z, idSlice.ptr, snbtSlice.ptr);
|
|
1649
|
+
|
|
1650
|
+
try {
|
|
1651
|
+
if (!diplomatReceive.resultFlag) {
|
|
1652
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1653
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
finally {
|
|
1658
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1659
|
+
functionCleanupArena.free();
|
|
1660
|
+
|
|
1661
|
+
diplomatReceive.free();
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Remove the block entity at a position. `NotFound` if none was there.
|
|
1667
|
+
*/
|
|
1668
|
+
removeBlockEntity(x, y, z) {
|
|
1669
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
const result = wasm.Schematic_remove_block_entity(diplomatReceive.buffer, this.ffiValue, x, y, z);
|
|
1673
|
+
|
|
1674
|
+
try {
|
|
1675
|
+
if (!diplomatReceive.resultFlag) {
|
|
1676
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1677
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
finally {
|
|
1682
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1683
|
+
diplomatReceive.free();
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Every block entity as a JSON array of `{id, position: [x,y,z], snbt}`.
|
|
1689
|
+
* The `snbt` is the inner data only (no `Id`/`Pos`).
|
|
1690
|
+
*/
|
|
1691
|
+
getAllBlockEntitiesSnbtJson() {
|
|
1692
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1693
|
+
|
|
1694
|
+
wasm.Schematic_get_all_block_entities_snbt_json(this.ffiValue, write.buffer);
|
|
1695
|
+
|
|
1696
|
+
try {
|
|
1697
|
+
return write.readString8();
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
finally {
|
|
1701
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1702
|
+
write.free();
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Every mobile entity as a JSON array of typed SNBT strings (full compound
|
|
1708
|
+
* incl. `id`/`Pos`).
|
|
1709
|
+
*/
|
|
1710
|
+
getEntitiesSnbtJson() {
|
|
1711
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1712
|
+
|
|
1713
|
+
wasm.Schematic_get_entities_snbt_json(this.ffiValue, write.buffer);
|
|
1714
|
+
|
|
1715
|
+
try {
|
|
1716
|
+
return write.readString8();
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
finally {
|
|
1720
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1721
|
+
write.free();
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Add a mobile entity from a full SNBT entity compound (must contain `id`
|
|
1727
|
+
* and `Pos`).
|
|
1728
|
+
*/
|
|
1729
|
+
addEntityFromSnbt(snbt) {
|
|
1730
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1731
|
+
|
|
1732
|
+
const snbtSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, snbt)));
|
|
1733
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
const result = wasm.Schematic_add_entity_from_snbt(diplomatReceive.buffer, this.ffiValue, snbtSlice.ptr);
|
|
1737
|
+
|
|
1738
|
+
try {
|
|
1739
|
+
if (!diplomatReceive.resultFlag) {
|
|
1740
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1741
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
finally {
|
|
1746
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1747
|
+
functionCleanupArena.free();
|
|
1748
|
+
|
|
1749
|
+
diplomatReceive.free();
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Every IN-BOUNDS cell as a JSON array of
|
|
1755
|
+
* `{"x", "y", "z", "name", "properties"}` (the old `CBlockArray`).
|
|
1756
|
+
* Air cells are materialized too — on a large sparse build this
|
|
1757
|
+
* dump is `volume()`-sized and can exhaust wasm memory; renderers
|
|
1758
|
+
* and analyzers want `get_non_air_blocks_json`.
|
|
1759
|
+
*
|
|
1760
|
+
* Prefer `get_non_air_blocks_json` for a block list,
|
|
1761
|
+
* `count_blocks_json` for a material tally and
|
|
1762
|
+
* `non_air_blocks_packed_b64` for bulk transfer. This method is
|
|
1763
|
+
* kept for compatibility and is the wrong tool at any real size.
|
|
1764
|
+
*/
|
|
1765
|
+
getAllBlocksJson() {
|
|
1766
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1767
|
+
|
|
1768
|
+
wasm.Schematic_get_all_blocks_json(this.ffiValue, write.buffer);
|
|
1769
|
+
|
|
1770
|
+
try {
|
|
1771
|
+
return write.readString8();
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
finally {
|
|
1775
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1776
|
+
write.free();
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* Every non-air block of ONE named region (a flattened design names
|
|
1782
|
+
* one per layer: `inst:{name}`, `bus:{name}`), same JSON shape as
|
|
1783
|
+
* `get_all_blocks_json`. Unknown region names error.
|
|
1784
|
+
*/
|
|
1785
|
+
getRegionNonAirBlocksJson(regionName) {
|
|
1786
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1787
|
+
|
|
1788
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
1789
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1790
|
+
|
|
1791
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1792
|
+
|
|
1793
|
+
|
|
1794
|
+
const result = wasm.Schematic_get_region_non_air_blocks_json(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, write.buffer);
|
|
1795
|
+
|
|
1796
|
+
try {
|
|
1797
|
+
if (!diplomatReceive.resultFlag) {
|
|
1798
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1799
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1800
|
+
}
|
|
1801
|
+
return write.readString8();
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
finally {
|
|
1805
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1806
|
+
functionCleanupArena.free();
|
|
1807
|
+
|
|
1808
|
+
diplomatReceive.free();
|
|
1809
|
+
write.free();
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* Every non-air block, same JSON shape as `get_all_blocks_json`.
|
|
1815
|
+
* `block_count()`-sized regardless of the bounding volume.
|
|
1816
|
+
*/
|
|
1817
|
+
getNonAirBlocksJson() {
|
|
1818
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1819
|
+
|
|
1820
|
+
wasm.Schematic_get_non_air_blocks_json(this.ffiValue, write.buffer);
|
|
1821
|
+
|
|
1822
|
+
try {
|
|
1823
|
+
return write.readString8();
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
finally {
|
|
1827
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1828
|
+
write.free();
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* Non-air blocks tallied by id: `{"minecraft:stone": 123, ...}`.
|
|
1834
|
+
* One pass, no per block allocation, so a caller that only wants a
|
|
1835
|
+
* material list never has to pull `get_non_air_blocks_json`. "Air"
|
|
1836
|
+
* covers `minecraft:air`, `cave_air` and `void_air` alike.
|
|
1837
|
+
*/
|
|
1838
|
+
countBlocksJson() {
|
|
1839
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1840
|
+
|
|
1841
|
+
wasm.Schematic_count_blocks_json(this.ffiValue, write.buffer);
|
|
1842
|
+
|
|
1843
|
+
try {
|
|
1844
|
+
return write.readString8();
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
finally {
|
|
1848
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1849
|
+
write.free();
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Apply a `{"from id": "to id"}` map in place and return how many
|
|
1855
|
+
* blocks changed. Keys match on block id only, ignoring block
|
|
1856
|
+
* states; values may carry states (`minecraft:oak_stairs[facing=north]`),
|
|
1857
|
+
* but not NBT: `parse_block_string` only returns a `BlockState`, so
|
|
1858
|
+
* any `{...}` payload on a `to` value is silently dropped rather
|
|
1859
|
+
* than copied onto the replaced block.
|
|
1860
|
+
* A block whose id is not a key is left alone, and so is one that
|
|
1861
|
+
* already equals its target: the count is the number of blocks
|
|
1862
|
+
* actually changed, so a map that rewrites stone to stone returns 0.
|
|
1863
|
+
* Errors with `Parse` on malformed JSON or an unparseable target id.
|
|
1864
|
+
*/
|
|
1865
|
+
replaceBlocksJson(mapJson) {
|
|
1866
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1867
|
+
|
|
1868
|
+
const mapJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, mapJson)));
|
|
1869
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 9, 8, true);
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
const result = wasm.Schematic_replace_blocks_json(diplomatReceive.buffer, this.ffiValue, mapJsonSlice.ptr);
|
|
1873
|
+
|
|
1874
|
+
try {
|
|
1875
|
+
if (!diplomatReceive.resultFlag) {
|
|
1876
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1877
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1878
|
+
}
|
|
1879
|
+
return (new BigUint64Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
finally {
|
|
1883
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1884
|
+
functionCleanupArena.free();
|
|
1885
|
+
|
|
1886
|
+
diplomatReceive.free();
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* Every non-air block as a compact binary blob, base64 encoded
|
|
1892
|
+
* (`DiplomatWrite` is UTF-8 only, see `to_litematic_b64`). Little
|
|
1893
|
+
* endian throughout:
|
|
1894
|
+
*
|
|
1895
|
+
* ```text
|
|
1896
|
+
* u32 count
|
|
1897
|
+
* count * { i32 x, i32 y, i32 z, u16 palette_index }
|
|
1898
|
+
* u32 palette_json_len
|
|
1899
|
+
* u8[palette_json_len] ["minecraft:stone", ...]
|
|
1900
|
+
* ```
|
|
1901
|
+
*
|
|
1902
|
+
* Palette indices are assigned in first-seen order, so the same
|
|
1903
|
+
* schematic always packs identically. About seven times smaller
|
|
1904
|
+
* than `get_non_air_blocks_json` and free of per block JSON
|
|
1905
|
+
* parsing on the far side.
|
|
1906
|
+
*
|
|
1907
|
+
* Palette indices are `u16`, so at most 65,535 distinct non-air
|
|
1908
|
+
* block states can be addressed. A schematic with more than that
|
|
1909
|
+
* writes **an empty string**, not a truncated palette: callers must
|
|
1910
|
+
* treat an empty result as "too many distinct states, fall back to
|
|
1911
|
+
* `get_non_air_blocks_json`". No real build has that many.
|
|
1912
|
+
*/
|
|
1913
|
+
nonAirBlocksPackedB64() {
|
|
1914
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1915
|
+
|
|
1916
|
+
wasm.Schematic_non_air_blocks_packed_b64(this.ffiValue, write.buffer);
|
|
1917
|
+
|
|
1918
|
+
try {
|
|
1919
|
+
return write.readString8();
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
finally {
|
|
1923
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1924
|
+
write.free();
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* All blocks within a sub-region (chunk) of the schematic, as the same
|
|
1930
|
+
* JSON array shape as `get_all_blocks_json`.
|
|
1931
|
+
*/
|
|
1932
|
+
getChunkBlocksJson(offsetX, offsetY, offsetZ, width, height, length) {
|
|
1933
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1934
|
+
|
|
1935
|
+
wasm.Schematic_get_chunk_blocks_json(this.ffiValue, offsetX, offsetY, offsetZ, width, height, length, write.buffer);
|
|
1936
|
+
|
|
1937
|
+
try {
|
|
1938
|
+
return write.readString8();
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
finally {
|
|
1942
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1943
|
+
write.free();
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
/**
|
|
1948
|
+
* Non-air blocks inside a bounded box, retaining block-state properties.
|
|
1949
|
+
* Visits only intersecting region cells, not the whole schematic. Bounds
|
|
1950
|
+
* and arithmetic are checked; queries may scan at most 1,048,576 cells
|
|
1951
|
+
* (including region overlaps) and emit at most 32 MiB of JSON. Renderers
|
|
1952
|
+
* should request 16³ sections. Coordinates may be negative.
|
|
1953
|
+
*/
|
|
1954
|
+
getChunkNonAirBlocksJson(offsetX, offsetY, offsetZ, width, height, length) {
|
|
1955
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1956
|
+
|
|
1957
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
const result = wasm.Schematic_get_chunk_non_air_blocks_json(diplomatReceive.buffer, this.ffiValue, offsetX, offsetY, offsetZ, width, height, length, write.buffer);
|
|
1961
|
+
|
|
1962
|
+
try {
|
|
1963
|
+
if (!diplomatReceive.resultFlag) {
|
|
1964
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1965
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1966
|
+
}
|
|
1967
|
+
return write.readString8();
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
finally {
|
|
1971
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1972
|
+
diplomatReceive.free();
|
|
1973
|
+
write.free();
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Storage metadata and full block states for palette-index streaming. Region order
|
|
1979
|
+
* is default first, then sorted names (highest precedence first); indices are LOCAL to each region. Bounds
|
|
1980
|
+
* describe allocated storage, never tight bounds. x is fastest, then z, then y.
|
|
1981
|
+
* No block buffer is cloned or serialized here.
|
|
1982
|
+
*/
|
|
1983
|
+
renderRegionsJson() {
|
|
1984
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
1985
|
+
|
|
1986
|
+
wasm.Schematic_render_regions_json(this.ffiValue, write.buffer);
|
|
1987
|
+
|
|
1988
|
+
try {
|
|
1989
|
+
return write.readString8();
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
finally {
|
|
1993
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1994
|
+
write.free();
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
/**
|
|
1999
|
+
* A bounded window of a region's dense palette indices (including air).
|
|
2000
|
+
* At most 65,536 cells per call; no full-world scan, coordinate tuples, or
|
|
2001
|
+
* intermediate Rust allocation. JS bindings copy the borrowed slice before
|
|
2002
|
+
* returning, so callers may mutate the schematic or grow WASM memory safely.
|
|
2003
|
+
*/
|
|
2004
|
+
regionBlockIndices(regionName, start, count) {
|
|
2005
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2006
|
+
|
|
2007
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2008
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 9, 4, true);
|
|
2009
|
+
|
|
2010
|
+
// This lifetime edge depends on lifetimes 'a
|
|
2011
|
+
let aEdges = [this];
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
const result = wasm.Schematic_region_block_indices(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, start, count);
|
|
2015
|
+
|
|
2016
|
+
try {
|
|
2017
|
+
if (!diplomatReceive.resultFlag) {
|
|
2018
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2019
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2020
|
+
}
|
|
2021
|
+
return new diplomatRuntime.DiplomatSlicePrimitive(wasm, diplomatReceive.buffer, "u32", aEdges).getValue().slice();
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
finally {
|
|
2025
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2026
|
+
functionCleanupArena.free();
|
|
2027
|
+
|
|
2028
|
+
diplomatReceive.free();
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Split the schematic into chunks (default bottom-up strategy). Writes a
|
|
2034
|
+
* JSON array of `{"chunk_x", "chunk_y", "chunk_z", "blocks": [...]}` where
|
|
2035
|
+
* blocks have the `get_all_blocks_json` shape (the old `CChunkArray`).
|
|
2036
|
+
*/
|
|
2037
|
+
getChunksJson(chunkWidth, chunkHeight, chunkLength) {
|
|
2038
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2039
|
+
|
|
2040
|
+
wasm.Schematic_get_chunks_json(this.ffiValue, chunkWidth, chunkHeight, chunkLength, write.buffer);
|
|
2041
|
+
|
|
2042
|
+
try {
|
|
2043
|
+
return write.readString8();
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
finally {
|
|
2047
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2048
|
+
write.free();
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Split the schematic into chunks with a loading strategy: one of
|
|
2054
|
+
* `distance_to_camera`, `top_down`, `bottom_up`, `center_outward`,
|
|
2055
|
+
* `random` (anything else falls back to `bottom_up`). Camera coordinates
|
|
2056
|
+
* are only used by `distance_to_camera`. Same JSON shape as
|
|
2057
|
+
* `get_chunks_json`.
|
|
2058
|
+
*/
|
|
2059
|
+
getChunksWithStrategyJson(chunkWidth, chunkHeight, chunkLength, strategy, cameraX, cameraY, cameraZ) {
|
|
2060
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2061
|
+
|
|
2062
|
+
const strategySlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, strategy)));
|
|
2063
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2064
|
+
|
|
2065
|
+
wasm.Schematic_get_chunks_with_strategy_json(this.ffiValue, chunkWidth, chunkHeight, chunkLength, strategySlice.ptr, cameraX, cameraY, cameraZ, write.buffer);
|
|
2066
|
+
|
|
2067
|
+
try {
|
|
2068
|
+
return write.readString8();
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
finally {
|
|
2072
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2073
|
+
functionCleanupArena.free();
|
|
2074
|
+
|
|
2075
|
+
write.free();
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* The total number of non-air blocks in the schematic.
|
|
2081
|
+
*/
|
|
2082
|
+
blockCount() {
|
|
2083
|
+
|
|
2084
|
+
const result = wasm.Schematic_block_count(this.ffiValue);
|
|
2085
|
+
|
|
2086
|
+
try {
|
|
2087
|
+
return result;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
finally {
|
|
2091
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* The total volume of the schematic's bounding box.
|
|
2097
|
+
*/
|
|
2098
|
+
volume() {
|
|
2099
|
+
|
|
2100
|
+
const result = wasm.Schematic_volume(this.ffiValue);
|
|
2101
|
+
|
|
2102
|
+
try {
|
|
2103
|
+
return result;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
finally {
|
|
2107
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* The names of all regions, as a JSON array of strings.
|
|
2113
|
+
*/
|
|
2114
|
+
regionNamesJson() {
|
|
2115
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2116
|
+
|
|
2117
|
+
wasm.Schematic_region_names_json(this.ffiValue, write.buffer);
|
|
2118
|
+
|
|
2119
|
+
try {
|
|
2120
|
+
return write.readString8();
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
finally {
|
|
2124
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2125
|
+
write.free();
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* Basic debug info about the schematic (name + region count).
|
|
2131
|
+
*/
|
|
2132
|
+
debugInfo() {
|
|
2133
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2134
|
+
|
|
2135
|
+
wasm.Schematic_debug_info(this.ffiValue, write.buffer);
|
|
2136
|
+
|
|
2137
|
+
try {
|
|
2138
|
+
return write.readString8();
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
finally {
|
|
2142
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2143
|
+
write.free();
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* A formatted schematic layout string (old `schematic_print`).
|
|
2149
|
+
*/
|
|
2150
|
+
printString() {
|
|
2151
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2152
|
+
|
|
2153
|
+
wasm.Schematic_print_string(this.ffiValue, write.buffer);
|
|
2154
|
+
|
|
2155
|
+
try {
|
|
2156
|
+
return write.readString8();
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
finally {
|
|
2160
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2161
|
+
write.free();
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* A formatted schematic layout string (old `schematic_print_schematic`;
|
|
2167
|
+
* same output as `print_string`).
|
|
2168
|
+
*/
|
|
2169
|
+
printSchematicString() {
|
|
2170
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2171
|
+
|
|
2172
|
+
wasm.Schematic_print_schematic_string(this.ffiValue, write.buffer);
|
|
2173
|
+
|
|
2174
|
+
try {
|
|
2175
|
+
return write.readString8();
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
finally {
|
|
2179
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2180
|
+
write.free();
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* A detailed debug string, including a visual layout (old `debug_schematic`).
|
|
2186
|
+
*/
|
|
2187
|
+
debugString() {
|
|
2188
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2189
|
+
|
|
2190
|
+
wasm.Schematic_debug_string(this.ffiValue, write.buffer);
|
|
2191
|
+
|
|
2192
|
+
try {
|
|
2193
|
+
return write.readString8();
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
finally {
|
|
2197
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2198
|
+
write.free();
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* A detailed debug string with a JSON layout (old `debug_json_schematic`).
|
|
2204
|
+
*/
|
|
2205
|
+
debugJsonString() {
|
|
2206
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2207
|
+
|
|
2208
|
+
wasm.Schematic_debug_json_string(this.ffiValue, write.buffer);
|
|
2209
|
+
|
|
2210
|
+
try {
|
|
2211
|
+
return write.readString8();
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
finally {
|
|
2215
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2216
|
+
write.free();
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* The schematic name, or the empty string if not set.
|
|
2222
|
+
*
|
|
2223
|
+
* Total, like every other metadata accessor: absence is a blank
|
|
2224
|
+
* field, not an error — a file that simply doesn't carry the field
|
|
2225
|
+
* (Sponge without attribution, a fresh schematic) reads as `""`,
|
|
2226
|
+
* the same value a litematic round-trip of an unset field yields.
|
|
2227
|
+
*/
|
|
2228
|
+
name() {
|
|
2229
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2230
|
+
|
|
2231
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
const result = wasm.Schematic_name(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
2235
|
+
|
|
2236
|
+
try {
|
|
2237
|
+
if (!diplomatReceive.resultFlag) {
|
|
2238
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2239
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2240
|
+
}
|
|
2241
|
+
return write.readString8();
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
finally {
|
|
2245
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2246
|
+
diplomatReceive.free();
|
|
2247
|
+
write.free();
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Set the schematic name.
|
|
2253
|
+
*/
|
|
2254
|
+
setName(name) {
|
|
2255
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2256
|
+
|
|
2257
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
2258
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
const result = wasm.Schematic_set_name(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr);
|
|
2262
|
+
|
|
2263
|
+
try {
|
|
2264
|
+
if (!diplomatReceive.resultFlag) {
|
|
2265
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2266
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
finally {
|
|
2271
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2272
|
+
functionCleanupArena.free();
|
|
2273
|
+
|
|
2274
|
+
diplomatReceive.free();
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* The schematic author, or the empty string if not set.
|
|
2280
|
+
*
|
|
2281
|
+
* Total, like every other metadata accessor: absence is a blank
|
|
2282
|
+
* field, not an error — a file that simply doesn't carry the field
|
|
2283
|
+
* (Sponge without attribution, a fresh schematic) reads as `""`,
|
|
2284
|
+
* the same value a litematic round-trip of an unset field yields.
|
|
2285
|
+
*/
|
|
2286
|
+
author() {
|
|
2287
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2288
|
+
|
|
2289
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
const result = wasm.Schematic_author(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
2293
|
+
|
|
2294
|
+
try {
|
|
2295
|
+
if (!diplomatReceive.resultFlag) {
|
|
2296
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2297
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2298
|
+
}
|
|
2299
|
+
return write.readString8();
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
finally {
|
|
2303
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2304
|
+
diplomatReceive.free();
|
|
2305
|
+
write.free();
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* Set the schematic author.
|
|
2311
|
+
*/
|
|
2312
|
+
setAuthor(author) {
|
|
2313
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2314
|
+
|
|
2315
|
+
const authorSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, author)));
|
|
2316
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
const result = wasm.Schematic_set_author(diplomatReceive.buffer, this.ffiValue, authorSlice.ptr);
|
|
2320
|
+
|
|
2321
|
+
try {
|
|
2322
|
+
if (!diplomatReceive.resultFlag) {
|
|
2323
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2324
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
finally {
|
|
2329
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2330
|
+
functionCleanupArena.free();
|
|
2331
|
+
|
|
2332
|
+
diplomatReceive.free();
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* The schematic description, or the empty string if not set.
|
|
2338
|
+
*
|
|
2339
|
+
* Total, like every other metadata accessor: absence is a blank
|
|
2340
|
+
* field, not an error — a file that simply doesn't carry the field
|
|
2341
|
+
* (Sponge without attribution, a fresh schematic) reads as `""`,
|
|
2342
|
+
* the same value a litematic round-trip of an unset field yields.
|
|
2343
|
+
*/
|
|
2344
|
+
description() {
|
|
2345
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2346
|
+
|
|
2347
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
const result = wasm.Schematic_description(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
2351
|
+
|
|
2352
|
+
try {
|
|
2353
|
+
if (!diplomatReceive.resultFlag) {
|
|
2354
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2355
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2356
|
+
}
|
|
2357
|
+
return write.readString8();
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
finally {
|
|
2361
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2362
|
+
diplomatReceive.free();
|
|
2363
|
+
write.free();
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
/**
|
|
2368
|
+
* Set the schematic description.
|
|
2369
|
+
*/
|
|
2370
|
+
setDescription(description) {
|
|
2371
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2372
|
+
|
|
2373
|
+
const descriptionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, description)));
|
|
2374
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
const result = wasm.Schematic_set_description(diplomatReceive.buffer, this.ffiValue, descriptionSlice.ptr);
|
|
2378
|
+
|
|
2379
|
+
try {
|
|
2380
|
+
if (!diplomatReceive.resultFlag) {
|
|
2381
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2382
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
finally {
|
|
2387
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2388
|
+
functionCleanupArena.free();
|
|
2389
|
+
|
|
2390
|
+
diplomatReceive.free();
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* The creation timestamp (milliseconds since epoch), or `-1` if not set.
|
|
2396
|
+
*/
|
|
2397
|
+
created() {
|
|
2398
|
+
|
|
2399
|
+
const result = wasm.Schematic_created(this.ffiValue);
|
|
2400
|
+
|
|
2401
|
+
try {
|
|
2402
|
+
return result;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
finally {
|
|
2406
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Set the creation timestamp (milliseconds since epoch).
|
|
2412
|
+
*/
|
|
2413
|
+
setCreated(created) {
|
|
2414
|
+
wasm.Schematic_set_created(this.ffiValue, created);
|
|
2415
|
+
|
|
2416
|
+
try {}
|
|
2417
|
+
|
|
2418
|
+
finally {
|
|
2419
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* The modification timestamp (milliseconds since epoch), or `-1` if not set.
|
|
2425
|
+
*/
|
|
2426
|
+
modified() {
|
|
2427
|
+
|
|
2428
|
+
const result = wasm.Schematic_modified(this.ffiValue);
|
|
2429
|
+
|
|
2430
|
+
try {
|
|
2431
|
+
return result;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
finally {
|
|
2435
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* Set the modification timestamp (milliseconds since epoch).
|
|
2441
|
+
*/
|
|
2442
|
+
setModified(modified) {
|
|
2443
|
+
wasm.Schematic_set_modified(this.ffiValue, modified);
|
|
2444
|
+
|
|
2445
|
+
try {}
|
|
2446
|
+
|
|
2447
|
+
finally {
|
|
2448
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* The Litematic format version, or `-1` if not set.
|
|
2454
|
+
*/
|
|
2455
|
+
lmVersion() {
|
|
2456
|
+
|
|
2457
|
+
const result = wasm.Schematic_lm_version(this.ffiValue);
|
|
2458
|
+
|
|
2459
|
+
try {
|
|
2460
|
+
return result;
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
finally {
|
|
2464
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* Set the Litematic format version.
|
|
2470
|
+
*/
|
|
2471
|
+
setLmVersion(version) {
|
|
2472
|
+
wasm.Schematic_set_lm_version(this.ffiValue, version);
|
|
2473
|
+
|
|
2474
|
+
try {}
|
|
2475
|
+
|
|
2476
|
+
finally {
|
|
2477
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* The Minecraft data version, or `-1` if not set.
|
|
2483
|
+
*/
|
|
2484
|
+
mcVersion() {
|
|
2485
|
+
|
|
2486
|
+
const result = wasm.Schematic_mc_version(this.ffiValue);
|
|
2487
|
+
|
|
2488
|
+
try {
|
|
2489
|
+
return result;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
finally {
|
|
2493
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
/**
|
|
2498
|
+
* Set the Minecraft data version.
|
|
2499
|
+
*/
|
|
2500
|
+
setMcVersion(version) {
|
|
2501
|
+
wasm.Schematic_set_mc_version(this.ffiValue, version);
|
|
2502
|
+
|
|
2503
|
+
try {}
|
|
2504
|
+
|
|
2505
|
+
finally {
|
|
2506
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
/**
|
|
2511
|
+
* The WorldEdit version, or `-1` if not set.
|
|
2512
|
+
*/
|
|
2513
|
+
weVersion() {
|
|
2514
|
+
|
|
2515
|
+
const result = wasm.Schematic_we_version(this.ffiValue);
|
|
2516
|
+
|
|
2517
|
+
try {
|
|
2518
|
+
return result;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
finally {
|
|
2522
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
/**
|
|
2527
|
+
* Set the WorldEdit version.
|
|
2528
|
+
*/
|
|
2529
|
+
setWeVersion(version) {
|
|
2530
|
+
wasm.Schematic_set_we_version(this.ffiValue, version);
|
|
2531
|
+
|
|
2532
|
+
try {}
|
|
2533
|
+
|
|
2534
|
+
finally {
|
|
2535
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* Standard embedded source provenance as canonical JSON. Returns an
|
|
2541
|
+
* empty string when none is present.
|
|
2542
|
+
*/
|
|
2543
|
+
provenanceJson() {
|
|
2544
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2545
|
+
|
|
2546
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
const result = wasm.Schematic_provenance_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
2550
|
+
|
|
2551
|
+
try {
|
|
2552
|
+
if (!diplomatReceive.resultFlag) {
|
|
2553
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2554
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2555
|
+
}
|
|
2556
|
+
return write.readString8();
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
finally {
|
|
2560
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2561
|
+
diplomatReceive.free();
|
|
2562
|
+
write.free();
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* Validate and set standard embedded source provenance from JSON.
|
|
2568
|
+
*/
|
|
2569
|
+
setProvenanceJson(json) {
|
|
2570
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2571
|
+
|
|
2572
|
+
const jsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, json)));
|
|
2573
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
const result = wasm.Schematic_set_provenance_json(diplomatReceive.buffer, this.ffiValue, jsonSlice.ptr);
|
|
2577
|
+
|
|
2578
|
+
try {
|
|
2579
|
+
if (!diplomatReceive.resultFlag) {
|
|
2580
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2581
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
finally {
|
|
2586
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2587
|
+
functionCleanupArena.free();
|
|
2588
|
+
|
|
2589
|
+
diplomatReceive.free();
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Remove embedded source provenance.
|
|
2595
|
+
*/
|
|
2596
|
+
clearProvenance() {
|
|
2597
|
+
wasm.Schematic_clear_provenance(this.ffiValue);
|
|
2598
|
+
|
|
2599
|
+
try {}
|
|
2600
|
+
|
|
2601
|
+
finally {
|
|
2602
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* Content-addressed processing history as a JSON array. This audit
|
|
2608
|
+
* trail is deliberately separate from immutable source provenance.
|
|
2609
|
+
*/
|
|
2610
|
+
transformationHistoryJson() {
|
|
2611
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2612
|
+
|
|
2613
|
+
wasm.Schematic_transformation_history_json(this.ffiValue, write.buffer);
|
|
2614
|
+
|
|
2615
|
+
try {
|
|
2616
|
+
return write.readString8();
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
finally {
|
|
2620
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2621
|
+
write.free();
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* Clear processing history without changing source provenance or
|
|
2627
|
+
* schematic content. Intended for callers constructing a new artifact
|
|
2628
|
+
* lineage, not for hiding registry audit records.
|
|
2629
|
+
*/
|
|
2630
|
+
clearTransformationHistory() {
|
|
2631
|
+
wasm.Schematic_clear_transformation_history(this.ffiValue);
|
|
2632
|
+
|
|
2633
|
+
try {}
|
|
2634
|
+
|
|
2635
|
+
finally {
|
|
2636
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Mirror the default region along the X axis (in place). Block
|
|
2642
|
+
* orientations, block entities, and entities are mirrored too.
|
|
2643
|
+
*/
|
|
2644
|
+
flipX() {
|
|
2645
|
+
wasm.Schematic_flip_x(this.ffiValue);
|
|
2646
|
+
|
|
2647
|
+
try {}
|
|
2648
|
+
|
|
2649
|
+
finally {
|
|
2650
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
/**
|
|
2655
|
+
* Mirror the default region along the Y axis (in place).
|
|
2656
|
+
*/
|
|
2657
|
+
flipY() {
|
|
2658
|
+
wasm.Schematic_flip_y(this.ffiValue);
|
|
2659
|
+
|
|
2660
|
+
try {}
|
|
2661
|
+
|
|
2662
|
+
finally {
|
|
2663
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
/**
|
|
2668
|
+
* Mirror the default region along the Z axis (in place).
|
|
2669
|
+
*/
|
|
2670
|
+
flipZ() {
|
|
2671
|
+
wasm.Schematic_flip_z(this.ffiValue);
|
|
2672
|
+
|
|
2673
|
+
try {}
|
|
2674
|
+
|
|
2675
|
+
finally {
|
|
2676
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* Rotate the default region about the X axis. +90° maps south (+Z)
|
|
2682
|
+
* to down (-Y). Only multiples of 90 are accepted; invalid angles
|
|
2683
|
+
* return `InvalidArgument` without changing the schematic. Negative
|
|
2684
|
+
* values wrap.
|
|
2685
|
+
*/
|
|
2686
|
+
rotateX(degrees) {
|
|
2687
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2688
|
+
|
|
2689
|
+
|
|
2690
|
+
const result = wasm.Schematic_rotate_x(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
2691
|
+
|
|
2692
|
+
try {
|
|
2693
|
+
if (!diplomatReceive.resultFlag) {
|
|
2694
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2695
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
finally {
|
|
2700
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2701
|
+
diplomatReceive.free();
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
/**
|
|
2706
|
+
* Rotate the default region clockwise about the Y axis when viewed
|
|
2707
|
+
* from above. +90° maps east (+X) to south (+Z).
|
|
2708
|
+
*/
|
|
2709
|
+
rotateY(degrees) {
|
|
2710
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2711
|
+
|
|
2712
|
+
|
|
2713
|
+
const result = wasm.Schematic_rotate_y(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
2714
|
+
|
|
2715
|
+
try {
|
|
2716
|
+
if (!diplomatReceive.resultFlag) {
|
|
2717
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2718
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
finally {
|
|
2723
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2724
|
+
diplomatReceive.free();
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
/**
|
|
2729
|
+
* Rotate the default region about the Z axis. +90° maps up (+Y) to
|
|
2730
|
+
* west (-X).
|
|
2731
|
+
*/
|
|
2732
|
+
rotateZ(degrees) {
|
|
2733
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
const result = wasm.Schematic_rotate_z(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
2737
|
+
|
|
2738
|
+
try {
|
|
2739
|
+
if (!diplomatReceive.resultFlag) {
|
|
2740
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2741
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
finally {
|
|
2746
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2747
|
+
diplomatReceive.free();
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
/**
|
|
2752
|
+
* Move the default region and all attached block entities/entities.
|
|
2753
|
+
*/
|
|
2754
|
+
translate(dx, dy, dz) {
|
|
2755
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
const result = wasm.Schematic_translate(diplomatReceive.buffer, this.ffiValue, dx, dy, dz);
|
|
2759
|
+
|
|
2760
|
+
try {
|
|
2761
|
+
if (!diplomatReceive.resultFlag) {
|
|
2762
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2763
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
finally {
|
|
2768
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2769
|
+
diplomatReceive.free();
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
/**
|
|
2774
|
+
* Mirror a named region along the X axis.
|
|
2775
|
+
*/
|
|
2776
|
+
flipRegionX(regionName) {
|
|
2777
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2778
|
+
|
|
2779
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2780
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
const result = wasm.Schematic_flip_region_x(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
2784
|
+
|
|
2785
|
+
try {
|
|
2786
|
+
if (!diplomatReceive.resultFlag) {
|
|
2787
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2788
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
finally {
|
|
2793
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2794
|
+
functionCleanupArena.free();
|
|
2795
|
+
|
|
2796
|
+
diplomatReceive.free();
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
/**
|
|
2801
|
+
* Mirror a named region along the Y axis.
|
|
2802
|
+
*/
|
|
2803
|
+
flipRegionY(regionName) {
|
|
2804
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2805
|
+
|
|
2806
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2807
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
const result = wasm.Schematic_flip_region_y(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
2811
|
+
|
|
2812
|
+
try {
|
|
2813
|
+
if (!diplomatReceive.resultFlag) {
|
|
2814
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2815
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
finally {
|
|
2820
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2821
|
+
functionCleanupArena.free();
|
|
2822
|
+
|
|
2823
|
+
diplomatReceive.free();
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* Mirror a named region along the Z axis.
|
|
2829
|
+
*/
|
|
2830
|
+
flipRegionZ(regionName) {
|
|
2831
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2832
|
+
|
|
2833
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2834
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2835
|
+
|
|
2836
|
+
|
|
2837
|
+
const result = wasm.Schematic_flip_region_z(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
2838
|
+
|
|
2839
|
+
try {
|
|
2840
|
+
if (!diplomatReceive.resultFlag) {
|
|
2841
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2842
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
finally {
|
|
2847
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2848
|
+
functionCleanupArena.free();
|
|
2849
|
+
|
|
2850
|
+
diplomatReceive.free();
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
/**
|
|
2855
|
+
* Rotate a named region about the X axis by a multiple of 90 degrees.
|
|
2856
|
+
*/
|
|
2857
|
+
rotateRegionX(regionName, degrees) {
|
|
2858
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2859
|
+
|
|
2860
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2861
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
const result = wasm.Schematic_rotate_region_x(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, degrees);
|
|
2865
|
+
|
|
2866
|
+
try {
|
|
2867
|
+
if (!diplomatReceive.resultFlag) {
|
|
2868
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2869
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
finally {
|
|
2874
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2875
|
+
functionCleanupArena.free();
|
|
2876
|
+
|
|
2877
|
+
diplomatReceive.free();
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
/**
|
|
2882
|
+
* Rotate a named region clockwise about the Y axis by a multiple of
|
|
2883
|
+
* 90 degrees.
|
|
2884
|
+
*/
|
|
2885
|
+
rotateRegionY(regionName, degrees) {
|
|
2886
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2887
|
+
|
|
2888
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2889
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
const result = wasm.Schematic_rotate_region_y(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, degrees);
|
|
2893
|
+
|
|
2894
|
+
try {
|
|
2895
|
+
if (!diplomatReceive.resultFlag) {
|
|
2896
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2897
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
finally {
|
|
2902
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2903
|
+
functionCleanupArena.free();
|
|
2904
|
+
|
|
2905
|
+
diplomatReceive.free();
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* Rotate a named region about the Z axis by a multiple of 90 degrees.
|
|
2911
|
+
*/
|
|
2912
|
+
rotateRegionZ(regionName, degrees) {
|
|
2913
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2914
|
+
|
|
2915
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2916
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2917
|
+
|
|
2918
|
+
|
|
2919
|
+
const result = wasm.Schematic_rotate_region_z(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, degrees);
|
|
2920
|
+
|
|
2921
|
+
try {
|
|
2922
|
+
if (!diplomatReceive.resultFlag) {
|
|
2923
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2924
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
finally {
|
|
2929
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2930
|
+
functionCleanupArena.free();
|
|
2931
|
+
|
|
2932
|
+
diplomatReceive.free();
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
/**
|
|
2937
|
+
* Move one named region without affecting its siblings.
|
|
2938
|
+
*/
|
|
2939
|
+
translateRegion(regionName, dx, dy, dz) {
|
|
2940
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
2941
|
+
|
|
2942
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
2943
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
const result = wasm.Schematic_translate_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, dx, dy, dz);
|
|
2947
|
+
|
|
2948
|
+
try {
|
|
2949
|
+
if (!diplomatReceive.resultFlag) {
|
|
2950
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2951
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
finally {
|
|
2956
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2957
|
+
functionCleanupArena.free();
|
|
2958
|
+
|
|
2959
|
+
diplomatReceive.free();
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
/**
|
|
2964
|
+
* Rotate every region as one rigid schematic around the shared bounds.
|
|
2965
|
+
*/
|
|
2966
|
+
rotateSchematicX(degrees) {
|
|
2967
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
const result = wasm.Schematic_rotate_schematic_x(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
2971
|
+
|
|
2972
|
+
try {
|
|
2973
|
+
if (!diplomatReceive.resultFlag) {
|
|
2974
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2975
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
finally {
|
|
2980
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2981
|
+
diplomatReceive.free();
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* Rotate every region as one rigid schematic around the shared bounds.
|
|
2987
|
+
*/
|
|
2988
|
+
rotateSchematicY(degrees) {
|
|
2989
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
const result = wasm.Schematic_rotate_schematic_y(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
2993
|
+
|
|
2994
|
+
try {
|
|
2995
|
+
if (!diplomatReceive.resultFlag) {
|
|
2996
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
2997
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
finally {
|
|
3002
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3003
|
+
diplomatReceive.free();
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
/**
|
|
3008
|
+
* Rotate every region as one rigid schematic around the shared bounds.
|
|
3009
|
+
*/
|
|
3010
|
+
rotateSchematicZ(degrees) {
|
|
3011
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
const result = wasm.Schematic_rotate_schematic_z(diplomatReceive.buffer, this.ffiValue, degrees);
|
|
3015
|
+
|
|
3016
|
+
try {
|
|
3017
|
+
if (!diplomatReceive.resultFlag) {
|
|
3018
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3019
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
finally {
|
|
3024
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3025
|
+
diplomatReceive.free();
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* Mirror every region across the shared schematic X bounds.
|
|
3031
|
+
*/
|
|
3032
|
+
flipSchematicX() {
|
|
3033
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
const result = wasm.Schematic_flip_schematic_x(diplomatReceive.buffer, this.ffiValue);
|
|
3037
|
+
|
|
3038
|
+
try {
|
|
3039
|
+
if (!diplomatReceive.resultFlag) {
|
|
3040
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3041
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
finally {
|
|
3046
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3047
|
+
diplomatReceive.free();
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* Mirror every region across the shared schematic Y bounds.
|
|
3053
|
+
*/
|
|
3054
|
+
flipSchematicY() {
|
|
3055
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
const result = wasm.Schematic_flip_schematic_y(diplomatReceive.buffer, this.ffiValue);
|
|
3059
|
+
|
|
3060
|
+
try {
|
|
3061
|
+
if (!diplomatReceive.resultFlag) {
|
|
3062
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3063
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
finally {
|
|
3068
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3069
|
+
diplomatReceive.free();
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
/**
|
|
3074
|
+
* Mirror every region across the shared schematic Z bounds.
|
|
3075
|
+
*/
|
|
3076
|
+
flipSchematicZ() {
|
|
3077
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
const result = wasm.Schematic_flip_schematic_z(diplomatReceive.buffer, this.ffiValue);
|
|
3081
|
+
|
|
3082
|
+
try {
|
|
3083
|
+
if (!diplomatReceive.resultFlag) {
|
|
3084
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3085
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
finally {
|
|
3090
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3091
|
+
diplomatReceive.free();
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
/**
|
|
3096
|
+
* Move every region by the same delta, preserving their relative layout.
|
|
3097
|
+
*/
|
|
3098
|
+
translateSchematic(dx, dy, dz) {
|
|
3099
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
const result = wasm.Schematic_translate_schematic(diplomatReceive.buffer, this.ffiValue, dx, dy, dz);
|
|
3103
|
+
|
|
3104
|
+
try {
|
|
3105
|
+
if (!diplomatReceive.resultFlag) {
|
|
3106
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3107
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
finally {
|
|
3112
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3113
|
+
diplomatReceive.free();
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
/**
|
|
3118
|
+
* Fill a cuboid with a block.
|
|
3119
|
+
*/
|
|
3120
|
+
fillCuboid(minX, minY, minZ, maxX, maxY, maxZ, blockName) {
|
|
3121
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3122
|
+
|
|
3123
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
3124
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
const result = wasm.Schematic_fill_cuboid(diplomatReceive.buffer, this.ffiValue, minX, minY, minZ, maxX, maxY, maxZ, blockNameSlice.ptr);
|
|
3128
|
+
|
|
3129
|
+
try {
|
|
3130
|
+
if (!diplomatReceive.resultFlag) {
|
|
3131
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3132
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
finally {
|
|
3137
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3138
|
+
functionCleanupArena.free();
|
|
3139
|
+
|
|
3140
|
+
diplomatReceive.free();
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
/**
|
|
3145
|
+
* Fill a sphere with a block.
|
|
3146
|
+
*/
|
|
3147
|
+
fillSphere(cx, cy, cz, radius, blockName) {
|
|
3148
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3149
|
+
|
|
3150
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
3151
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
const result = wasm.Schematic_fill_sphere(diplomatReceive.buffer, this.ffiValue, cx, cy, cz, radius, blockNameSlice.ptr);
|
|
3155
|
+
|
|
3156
|
+
try {
|
|
3157
|
+
if (!diplomatReceive.resultFlag) {
|
|
3158
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3159
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
finally {
|
|
3164
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3165
|
+
functionCleanupArena.free();
|
|
3166
|
+
|
|
3167
|
+
diplomatReceive.free();
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
/**
|
|
3172
|
+
* Serialize to a named format, base64-encoded. `version` and `settings`
|
|
3173
|
+
* may be empty strings for defaults.
|
|
3174
|
+
*/
|
|
3175
|
+
saveAsB64(format, version, settings) {
|
|
3176
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3177
|
+
|
|
3178
|
+
const formatSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, format)));
|
|
3179
|
+
const versionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, version)));
|
|
3180
|
+
const settingsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, settings)));
|
|
3181
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3182
|
+
|
|
3183
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
const result = wasm.Schematic_save_as_b64(diplomatReceive.buffer, this.ffiValue, formatSlice.ptr, versionSlice.ptr, settingsSlice.ptr, write.buffer);
|
|
3187
|
+
|
|
3188
|
+
try {
|
|
3189
|
+
if (!diplomatReceive.resultFlag) {
|
|
3190
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3191
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3192
|
+
}
|
|
3193
|
+
return write.readString8();
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
finally {
|
|
3197
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3198
|
+
functionCleanupArena.free();
|
|
3199
|
+
|
|
3200
|
+
diplomatReceive.free();
|
|
3201
|
+
write.free();
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
/**
|
|
3206
|
+
* Serialize as a Sponge schematic targeting a specific format version,
|
|
3207
|
+
* base64-encoded.
|
|
3208
|
+
*/
|
|
3209
|
+
toSchematicVersionB64(version) {
|
|
3210
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3211
|
+
|
|
3212
|
+
const versionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, version)));
|
|
3213
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3214
|
+
|
|
3215
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3216
|
+
|
|
3217
|
+
|
|
3218
|
+
const result = wasm.Schematic_to_schematic_version_b64(diplomatReceive.buffer, this.ffiValue, versionSlice.ptr, write.buffer);
|
|
3219
|
+
|
|
3220
|
+
try {
|
|
3221
|
+
if (!diplomatReceive.resultFlag) {
|
|
3222
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3223
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3224
|
+
}
|
|
3225
|
+
return write.readString8();
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
finally {
|
|
3229
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3230
|
+
functionCleanupArena.free();
|
|
3231
|
+
|
|
3232
|
+
diplomatReceive.free();
|
|
3233
|
+
write.free();
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
/**
|
|
3238
|
+
* The available Sponge schematic exporter versions, as a JSON array of
|
|
3239
|
+
* strings.
|
|
3240
|
+
*/
|
|
3241
|
+
static availableSchematicVersionsJson() {
|
|
3242
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3243
|
+
|
|
3244
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3245
|
+
|
|
3246
|
+
|
|
3247
|
+
const result = wasm.Schematic_available_schematic_versions_json(diplomatReceive.buffer, write.buffer);
|
|
3248
|
+
|
|
3249
|
+
try {
|
|
3250
|
+
if (!diplomatReceive.resultFlag) {
|
|
3251
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3252
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3253
|
+
}
|
|
3254
|
+
return write.readString8();
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
finally {
|
|
3258
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3259
|
+
diplomatReceive.free();
|
|
3260
|
+
write.free();
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
* Set a block with NBT data given as a JSON object of string→string
|
|
3266
|
+
* (may be empty).
|
|
3267
|
+
*/
|
|
3268
|
+
setBlockWithNbt(x, y, z, blockName, nbtJson) {
|
|
3269
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3270
|
+
|
|
3271
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
3272
|
+
const nbtJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, nbtJson)));
|
|
3273
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3274
|
+
|
|
3275
|
+
|
|
3276
|
+
const result = wasm.Schematic_set_block_with_nbt(diplomatReceive.buffer, this.ffiValue, x, y, z, blockNameSlice.ptr, nbtJsonSlice.ptr);
|
|
3277
|
+
|
|
3278
|
+
try {
|
|
3279
|
+
if (!diplomatReceive.resultFlag) {
|
|
3280
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3281
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
finally {
|
|
3286
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3287
|
+
functionCleanupArena.free();
|
|
3288
|
+
|
|
3289
|
+
diplomatReceive.free();
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
/**
|
|
3294
|
+
* Set a block (by name) in a named region.
|
|
3295
|
+
*/
|
|
3296
|
+
setBlockInRegion(regionName, x, y, z, blockName) {
|
|
3297
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3298
|
+
|
|
3299
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3300
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
3301
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
const result = wasm.Schematic_set_block_in_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, x, y, z, blockNameSlice.ptr);
|
|
3305
|
+
|
|
3306
|
+
try {
|
|
3307
|
+
if (!diplomatReceive.resultFlag) {
|
|
3308
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3309
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
finally {
|
|
3314
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3315
|
+
functionCleanupArena.free();
|
|
3316
|
+
|
|
3317
|
+
diplomatReceive.free();
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
/**
|
|
3322
|
+
* Whether a default or named schematic region exists.
|
|
3323
|
+
*/
|
|
3324
|
+
hasRegion(regionName) {
|
|
3325
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3326
|
+
|
|
3327
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3328
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 1, true);
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
const result = wasm.Schematic_has_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
3332
|
+
|
|
3333
|
+
try {
|
|
3334
|
+
if (!diplomatReceive.resultFlag) {
|
|
3335
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3336
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3337
|
+
}
|
|
3338
|
+
return (new Uint8Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0] === 1;
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
finally {
|
|
3342
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3343
|
+
functionCleanupArena.free();
|
|
3344
|
+
|
|
3345
|
+
diplomatReceive.free();
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* Create an empty named region. Its first block anchors its bounds.
|
|
3351
|
+
*/
|
|
3352
|
+
createRegion(regionName) {
|
|
3353
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3354
|
+
|
|
3355
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3356
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
const result = wasm.Schematic_create_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
3360
|
+
|
|
3361
|
+
try {
|
|
3362
|
+
if (!diplomatReceive.resultFlag) {
|
|
3363
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3364
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
finally {
|
|
3369
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3370
|
+
functionCleanupArena.free();
|
|
3371
|
+
|
|
3372
|
+
diplomatReceive.free();
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
/**
|
|
3377
|
+
* Remove a named region. The default region cannot be removed.
|
|
3378
|
+
*/
|
|
3379
|
+
removeRegion(regionName) {
|
|
3380
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3381
|
+
|
|
3382
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3383
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
const result = wasm.Schematic_remove_region(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr);
|
|
3387
|
+
|
|
3388
|
+
try {
|
|
3389
|
+
if (!diplomatReceive.resultFlag) {
|
|
3390
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3391
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3395
|
+
finally {
|
|
3396
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3397
|
+
functionCleanupArena.free();
|
|
3398
|
+
|
|
3399
|
+
diplomatReceive.free();
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
/**
|
|
3404
|
+
* Rename a named region. The default region cannot be renamed.
|
|
3405
|
+
*/
|
|
3406
|
+
renameRegion(oldName, newName) {
|
|
3407
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3408
|
+
|
|
3409
|
+
const oldNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, oldName)));
|
|
3410
|
+
const newNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, newName)));
|
|
3411
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
const result = wasm.Schematic_rename_region(diplomatReceive.buffer, this.ffiValue, oldNameSlice.ptr, newNameSlice.ptr);
|
|
3415
|
+
|
|
3416
|
+
try {
|
|
3417
|
+
if (!diplomatReceive.resultFlag) {
|
|
3418
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3419
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
finally {
|
|
3424
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3425
|
+
functionCleanupArena.free();
|
|
3426
|
+
|
|
3427
|
+
diplomatReceive.free();
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* The schematic bounding box as a JSON array
|
|
3433
|
+
* `[min_x, min_y, min_z, max_x, max_y, max_z]`.
|
|
3434
|
+
*/
|
|
3435
|
+
boundingBoxJson() {
|
|
3436
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3437
|
+
|
|
3438
|
+
wasm.Schematic_bounding_box_json(this.ffiValue, write.buffer);
|
|
3439
|
+
|
|
3440
|
+
try {
|
|
3441
|
+
return write.readString8();
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
finally {
|
|
3445
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3446
|
+
write.free();
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
/**
|
|
3451
|
+
* A named region's bounding box as a JSON array
|
|
3452
|
+
* `[min_x, min_y, min_z, max_x, max_y, max_z]`. `"default"`/`"Default"`
|
|
3453
|
+
* address the default region.
|
|
3454
|
+
*/
|
|
3455
|
+
regionBoundingBoxJson(regionName) {
|
|
3456
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3457
|
+
|
|
3458
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3459
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3460
|
+
|
|
3461
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3462
|
+
|
|
3463
|
+
|
|
3464
|
+
const result = wasm.Schematic_region_bounding_box_json(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, write.buffer);
|
|
3465
|
+
|
|
3466
|
+
try {
|
|
3467
|
+
if (!diplomatReceive.resultFlag) {
|
|
3468
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3469
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3470
|
+
}
|
|
3471
|
+
return write.readString8();
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3474
|
+
finally {
|
|
3475
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3476
|
+
functionCleanupArena.free();
|
|
3477
|
+
|
|
3478
|
+
diplomatReceive.free();
|
|
3479
|
+
write.free();
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
/**
|
|
3484
|
+
* The merged-region palette block names, as a JSON array of strings.
|
|
3485
|
+
*/
|
|
3486
|
+
paletteJson() {
|
|
3487
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3488
|
+
|
|
3489
|
+
wasm.Schematic_palette_json(this.ffiValue, write.buffer);
|
|
3490
|
+
|
|
3491
|
+
try {
|
|
3492
|
+
return write.readString8();
|
|
3493
|
+
}
|
|
3494
|
+
|
|
3495
|
+
finally {
|
|
3496
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3497
|
+
write.free();
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
/**
|
|
3502
|
+
* The tight (content) dimensions.
|
|
3503
|
+
*/
|
|
3504
|
+
tightDimensions() {
|
|
3505
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 12, 4, false);
|
|
3506
|
+
|
|
3507
|
+
|
|
3508
|
+
const result = wasm.Schematic_tight_dimensions(diplomatReceive.buffer, this.ffiValue);
|
|
3509
|
+
|
|
3510
|
+
try {
|
|
3511
|
+
return Dimensions._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
finally {
|
|
3515
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3516
|
+
diplomatReceive.free();
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
/**
|
|
3521
|
+
* The allocated dimensions (same as `dimensions`; named for parity with
|
|
3522
|
+
* the old `schematic_get_allocated_dimensions`).
|
|
3523
|
+
*/
|
|
3524
|
+
allocatedDimensions() {
|
|
3525
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 12, 4, false);
|
|
3526
|
+
|
|
3527
|
+
|
|
3528
|
+
const result = wasm.Schematic_allocated_dimensions(diplomatReceive.buffer, this.ffiValue);
|
|
3529
|
+
|
|
3530
|
+
try {
|
|
3531
|
+
return Dimensions._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
finally {
|
|
3535
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3536
|
+
diplomatReceive.free();
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
/**
|
|
3541
|
+
* Every sign in the schematic, as a JSON array of
|
|
3542
|
+
* `{"pos": [x,y,z], "text": [...]}`.
|
|
3543
|
+
*/
|
|
3544
|
+
extractSignsJson() {
|
|
3545
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3546
|
+
|
|
3547
|
+
wasm.Schematic_extract_signs_json(this.ffiValue, write.buffer);
|
|
3548
|
+
|
|
3549
|
+
try {
|
|
3550
|
+
return write.readString8();
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
finally {
|
|
3554
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3555
|
+
write.free();
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
/**
|
|
3560
|
+
* Compile the schematic's insign annotations to JSON.
|
|
3561
|
+
*/
|
|
3562
|
+
compileInsignJson() {
|
|
3563
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3564
|
+
|
|
3565
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3566
|
+
|
|
3567
|
+
|
|
3568
|
+
const result = wasm.Schematic_compile_insign_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3569
|
+
|
|
3570
|
+
try {
|
|
3571
|
+
if (!diplomatReceive.resultFlag) {
|
|
3572
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3573
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3574
|
+
}
|
|
3575
|
+
return write.readString8();
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
finally {
|
|
3579
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3580
|
+
diplomatReceive.free();
|
|
3581
|
+
write.free();
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
/**
|
|
3586
|
+
* Embed a `CellContract` (JSON) in the schematic's metadata,
|
|
3587
|
+
* validating it parses first. The contract is carried through
|
|
3588
|
+
* `.schem` save/open and autodetected on open — schematic +
|
|
3589
|
+
* contract = one self-describing typed cell.
|
|
3590
|
+
*/
|
|
3591
|
+
setCellContractJson(json) {
|
|
3592
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3593
|
+
|
|
3594
|
+
const jsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, json)));
|
|
3595
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3596
|
+
|
|
3597
|
+
|
|
3598
|
+
const result = wasm.Schematic_set_cell_contract_json(diplomatReceive.buffer, this.ffiValue, jsonSlice.ptr);
|
|
3599
|
+
|
|
3600
|
+
try {
|
|
3601
|
+
if (!diplomatReceive.resultFlag) {
|
|
3602
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3603
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
finally {
|
|
3608
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3609
|
+
functionCleanupArena.free();
|
|
3610
|
+
|
|
3611
|
+
diplomatReceive.free();
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
/**
|
|
3616
|
+
* The contract embedded in the schematic's metadata, as JSON.
|
|
3617
|
+
* Errors with `NotFound` when none is embedded, `Parse` when an
|
|
3618
|
+
* embedded string exists but is corrupt (loud, never silent).
|
|
3619
|
+
*/
|
|
3620
|
+
cellContractJson() {
|
|
3621
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3622
|
+
|
|
3623
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3624
|
+
|
|
3625
|
+
|
|
3626
|
+
const result = wasm.Schematic_cell_contract_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3627
|
+
|
|
3628
|
+
try {
|
|
3629
|
+
if (!diplomatReceive.resultFlag) {
|
|
3630
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3631
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3632
|
+
}
|
|
3633
|
+
return write.readString8();
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
finally {
|
|
3637
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3638
|
+
diplomatReceive.free();
|
|
3639
|
+
write.free();
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
/**
|
|
3644
|
+
* Resolve the schematic's cell contract from its sources in
|
|
3645
|
+
* strict precedence — embedded metadata over Insign signs — with
|
|
3646
|
+
* loud conflict warnings. Writes `{"contract": ..., "warnings":
|
|
3647
|
+
* [...]}`; errors with `NotFound` when no source defines one.
|
|
3648
|
+
*/
|
|
3649
|
+
resolveCellContractJson() {
|
|
3650
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3651
|
+
|
|
3652
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3653
|
+
|
|
3654
|
+
|
|
3655
|
+
const result = wasm.Schematic_resolve_cell_contract_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3656
|
+
|
|
3657
|
+
try {
|
|
3658
|
+
if (!diplomatReceive.resultFlag) {
|
|
3659
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3660
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3661
|
+
}
|
|
3662
|
+
return write.readString8();
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
finally {
|
|
3666
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3667
|
+
diplomatReceive.free();
|
|
3668
|
+
write.free();
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* Parse the schematic's IO-contract insign annotations (`#cell`
|
|
3674
|
+
* header, `bus.*` port annotations, `#route_zone` zones) to JSON:
|
|
3675
|
+
* `{"cell": ..., "buses": [...], "route_zones": {...}}`.
|
|
3676
|
+
*/
|
|
3677
|
+
compileIoContractsJson() {
|
|
3678
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3679
|
+
|
|
3680
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3681
|
+
|
|
3682
|
+
|
|
3683
|
+
const result = wasm.Schematic_compile_io_contracts_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
3684
|
+
|
|
3685
|
+
try {
|
|
3686
|
+
if (!diplomatReceive.resultFlag) {
|
|
3687
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3688
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3689
|
+
}
|
|
3690
|
+
return write.readString8();
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
finally {
|
|
3694
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3695
|
+
diplomatReceive.free();
|
|
3696
|
+
write.free();
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
/**
|
|
3701
|
+
* Every region's palette, as a JSON object mapping region name → array of
|
|
3702
|
+
* block names (the default region under `"default"`).
|
|
3703
|
+
*/
|
|
3704
|
+
allPalettesJson() {
|
|
3705
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3706
|
+
|
|
3707
|
+
wasm.Schematic_all_palettes_json(this.ffiValue, write.buffer);
|
|
3708
|
+
|
|
3709
|
+
try {
|
|
3710
|
+
return write.readString8();
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
finally {
|
|
3714
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3715
|
+
write.free();
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
/**
|
|
3720
|
+
* The default region's palette block names, as a JSON array of strings.
|
|
3721
|
+
*/
|
|
3722
|
+
defaultRegionPaletteJson() {
|
|
3723
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3724
|
+
|
|
3725
|
+
wasm.Schematic_default_region_palette_json(this.ffiValue, write.buffer);
|
|
3726
|
+
|
|
3727
|
+
try {
|
|
3728
|
+
return write.readString8();
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
finally {
|
|
3732
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3733
|
+
write.free();
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
/**
|
|
3738
|
+
* A named region's palette block names, as a JSON array of strings.
|
|
3739
|
+
* `"default"`/`"Default"` address the default region.
|
|
3740
|
+
*/
|
|
3741
|
+
regionPaletteJson(regionName) {
|
|
3742
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
3743
|
+
|
|
3744
|
+
const regionNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, regionName)));
|
|
3745
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
3746
|
+
|
|
3747
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
3748
|
+
|
|
3749
|
+
|
|
3750
|
+
const result = wasm.Schematic_region_palette_json(diplomatReceive.buffer, this.ffiValue, regionNameSlice.ptr, write.buffer);
|
|
3751
|
+
|
|
3752
|
+
try {
|
|
3753
|
+
if (!diplomatReceive.resultFlag) {
|
|
3754
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3755
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3756
|
+
}
|
|
3757
|
+
return write.readString8();
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
finally {
|
|
3761
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3762
|
+
functionCleanupArena.free();
|
|
3763
|
+
|
|
3764
|
+
diplomatReceive.free();
|
|
3765
|
+
write.free();
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
/**
|
|
3770
|
+
* The minimum corner of the tight (content) bounds. `NotFound` when the
|
|
3771
|
+
* schematic has no content.
|
|
3772
|
+
*/
|
|
3773
|
+
tightBoundsMin() {
|
|
3774
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 13, 4, true);
|
|
3775
|
+
|
|
3776
|
+
|
|
3777
|
+
const result = wasm.Schematic_tight_bounds_min(diplomatReceive.buffer, this.ffiValue);
|
|
3778
|
+
|
|
3779
|
+
try {
|
|
3780
|
+
if (!diplomatReceive.resultFlag) {
|
|
3781
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3782
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3783
|
+
}
|
|
3784
|
+
return BlockPos._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
finally {
|
|
3788
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3789
|
+
diplomatReceive.free();
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
/**
|
|
3794
|
+
* The maximum corner of the tight (content) bounds. `NotFound` when the
|
|
3795
|
+
* schematic has no content.
|
|
3796
|
+
*/
|
|
3797
|
+
tightBoundsMax() {
|
|
3798
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 13, 4, true);
|
|
3799
|
+
|
|
3800
|
+
|
|
3801
|
+
const result = wasm.Schematic_tight_bounds_max(diplomatReceive.buffer, this.ffiValue);
|
|
3802
|
+
|
|
3803
|
+
try {
|
|
3804
|
+
if (!diplomatReceive.resultFlag) {
|
|
3805
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
3806
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
3807
|
+
}
|
|
3808
|
+
return BlockPos._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
|
|
3809
|
+
}
|
|
3810
|
+
|
|
3811
|
+
finally {
|
|
3812
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
3813
|
+
diplomatReceive.free();
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
constructor(symbol, ptr, selfEdge) {
|
|
3818
|
+
return this.#internalConstructor(...arguments)
|
|
3819
|
+
}
|
|
3820
|
+
}
|