nucleation 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/AnimationEffect.d.mts +44 -0
  2. package/AnimationEffect.d.ts +1 -1
  3. package/Autostack.d.mts +43 -0
  4. package/Autostack.d.ts +2 -2
  5. package/BlockPos.d.mts +28 -0
  6. package/BlockState.d.mts +39 -0
  7. package/BlockState.d.ts +1 -1
  8. package/Blocks.d.mts +91 -0
  9. package/Blocks.d.ts +1 -1
  10. package/Brush.d.mts +99 -0
  11. package/Brush.d.ts +21 -12
  12. package/Brush.mjs +66 -9
  13. package/BuildAnimation.d.mts +142 -0
  14. package/BuildAnimation.d.ts +5 -5
  15. package/BuildingTool.d.mts +46 -0
  16. package/BuildingTool.d.ts +4 -4
  17. package/CellularSdfConfig.d.mts +22 -0
  18. package/CellularSdfConfig.d.ts +22 -0
  19. package/CellularSdfConfig.mjs +69 -0
  20. package/ChunkMeshResult.d.mts +75 -0
  21. package/ChunkMeshResult.d.ts +7 -7
  22. package/CircuitBuilder.d.mts +118 -0
  23. package/CircuitBuilder.d.ts +6 -6
  24. package/Curve3D.d.mts +27 -0
  25. package/Curve3D.d.ts +1 -1
  26. package/DefinitionRegion.d.mts +274 -0
  27. package/DefinitionRegion.d.ts +5 -5
  28. package/Diff.d.mts +88 -0
  29. package/Diff.d.ts +2 -2
  30. package/Dimensions.d.mts +28 -0
  31. package/DistanceField.d.mts +39 -0
  32. package/DistanceField.d.ts +1 -1
  33. package/ExecutionMode.d.mts +42 -0
  34. package/ExecutionMode.d.ts +2 -2
  35. package/Field3.d.mts +40 -0
  36. package/Field3.d.ts +40 -0
  37. package/Field3.mjs +160 -0
  38. package/FieldProgram.d.mts +40 -0
  39. package/FieldProgram.d.ts +40 -0
  40. package/FieldProgram.mjs +167 -0
  41. package/FieldProgramBinaryOp.d.mts +42 -0
  42. package/FieldProgramBinaryOp.d.ts +42 -0
  43. package/FieldProgramBinaryOp.mjs +118 -0
  44. package/FieldProgramBuilder.d.mts +104 -0
  45. package/FieldProgramBuilder.d.ts +104 -0
  46. package/FieldProgramBuilder.mjs +486 -0
  47. package/FieldProgramDistanceKind.d.mts +26 -0
  48. package/FieldProgramDistanceKind.d.ts +26 -0
  49. package/FieldProgramDistanceKind.mjs +78 -0
  50. package/FieldProgramUnaryOp.d.mts +34 -0
  51. package/FieldProgramUnaryOp.d.ts +34 -0
  52. package/FieldProgramUnaryOp.mjs +102 -0
  53. package/FieldProgramValueType.d.mts +25 -0
  54. package/FieldProgramValueType.d.ts +25 -0
  55. package/FieldProgramValueType.mjs +75 -0
  56. package/FieldRange.d.mts +15 -0
  57. package/FieldRange.d.ts +15 -0
  58. package/FieldRange.mjs +108 -0
  59. package/Fingerprint.d.mts +44 -0
  60. package/Fingerprint.d.ts +2 -2
  61. package/GeneratedChunk.d.mts +35 -0
  62. package/GeneratedChunk.d.ts +35 -0
  63. package/GeneratedChunk.mjs +178 -0
  64. package/GeneratedChunkCoverage.d.mts +25 -0
  65. package/GeneratedChunkCoverage.d.ts +25 -0
  66. package/GeneratedChunkCoverage.mjs +75 -0
  67. package/GeneratedChunkOverlayMode.d.mts +24 -0
  68. package/GeneratedChunkOverlayMode.d.ts +24 -0
  69. package/GeneratedChunkOverlayMode.mjs +72 -0
  70. package/GeneratedWorldStream.d.mts +28 -0
  71. package/GeneratedWorldStream.d.ts +28 -0
  72. package/GeneratedWorldStream.mjs +86 -0
  73. package/Geo.d.mts +41 -0
  74. package/Geo.d.ts +2 -2
  75. package/InterpolationSpace.d.mts +25 -0
  76. package/IoLayout.d.mts +26 -0
  77. package/IoLayoutBuilder.d.mts +73 -0
  78. package/IoLayoutBuilder.d.ts +4 -4
  79. package/IoType.d.mts +41 -0
  80. package/ItemModelConfig.d.mts +65 -0
  81. package/ItemModelConfig.d.ts +1 -1
  82. package/ItemModelPackBuilder.d.mts +32 -0
  83. package/ItemModelPackBuilder.d.ts +1 -1
  84. package/ItemModelResult.d.mts +72 -0
  85. package/ItemModelResult.d.ts +7 -7
  86. package/ItemScale.d.mts +31 -0
  87. package/LayoutFunction.d.mts +52 -0
  88. package/LayoutFunction.d.ts +1 -1
  89. package/MchprsWorld.d.mts +131 -0
  90. package/MchprsWorld.d.ts +3 -3
  91. package/MeshBounds.d.mts +40 -0
  92. package/MeshConfig.d.mts +101 -0
  93. package/MeshConfig.d.ts +1 -1
  94. package/MeshJob.d.mts +44 -0
  95. package/MeshJob.d.ts +7 -7
  96. package/MeshPhase.d.mts +38 -0
  97. package/MeshProgress.d.mts +32 -0
  98. package/MeshProgress.d.ts +1 -1
  99. package/MeshResult.d.mts +65 -0
  100. package/MeshResult.d.ts +5 -5
  101. package/MultiMeshResult.d.mts +50 -0
  102. package/MultiMeshResult.d.ts +5 -5
  103. package/Nbt.d.mts +50 -0
  104. package/Nbt.d.ts +1 -1
  105. package/NucleationError.d.mts +41 -0
  106. package/NucleationError.d.ts +5 -0
  107. package/NucleationError.mjs +8 -1
  108. package/OutputCondition.d.mts +45 -0
  109. package/OutputCondition.d.ts +1 -1
  110. package/Palette.d.mts +145 -0
  111. package/Palette.d.ts +9 -1
  112. package/Palette.mjs +35 -0
  113. package/PaletteBuilder.d.mts +119 -0
  114. package/PaletteBuilder.d.ts +2 -2
  115. package/RawMeshExport.d.mts +74 -0
  116. package/RawMeshExport.d.ts +4 -4
  117. package/RedstoneGraph.d.mts +58 -0
  118. package/RedstoneGraph.d.ts +1 -1
  119. package/RegionBounds.d.mts +41 -0
  120. package/RenderConfig.d.mts +101 -0
  121. package/RenderConfig.d.ts +1 -1
  122. package/Renderer.d.mts +51 -0
  123. package/Renderer.d.ts +4 -4
  124. package/ResourcePack.d.mts +105 -0
  125. package/ResourcePack.d.ts +3 -3
  126. package/ResourcePackList.d.mts +32 -0
  127. package/Schematic.d.mts +734 -0
  128. package/Schematic.d.ts +4 -4
  129. package/SchematicBuilder.d.mts +103 -0
  130. package/SchematicBuilder.d.ts +2 -2
  131. package/SchematicRegions.d.mts +93 -0
  132. package/SchematicRegions.d.ts +3 -3
  133. package/Scripting.d.mts +40 -0
  134. package/Scripting.d.ts +2 -2
  135. package/Sdf.d.mts +234 -0
  136. package/Sdf.d.ts +208 -13
  137. package/Sdf.mjs +1106 -11
  138. package/SdfAxis.d.mts +25 -0
  139. package/SdfAxis.d.ts +25 -0
  140. package/SdfAxis.mjs +75 -0
  141. package/SdfBounds.d.mts +19 -0
  142. package/SdfBounds.d.ts +19 -0
  143. package/SdfBounds.mjs +160 -0
  144. package/SdfCellMode.d.mts +26 -0
  145. package/SdfCellMode.d.ts +26 -0
  146. package/SdfCellMode.mjs +78 -0
  147. package/SdfNormal.d.mts +16 -0
  148. package/SdfNormal.d.ts +16 -0
  149. package/SdfNormal.mjs +121 -0
  150. package/Shape.d.mts +143 -0
  151. package/Shape.d.ts +2 -2
  152. package/SortStrategy.d.mts +86 -0
  153. package/SortStrategy.d.ts +1 -1
  154. package/Store.d.mts +83 -0
  155. package/Store.d.ts +2 -2
  156. package/StoreIo.d.mts +71 -0
  157. package/StoreIo.d.ts +2 -2
  158. package/TextureAtlas.d.mts +40 -0
  159. package/TextureAtlas.d.ts +4 -4
  160. package/TextureInfo.d.mts +34 -0
  161. package/TypedCircuitExecutor.d.mts +101 -0
  162. package/TypedCircuitExecutor.d.ts +6 -6
  163. package/Value.d.mts +73 -0
  164. package/Value.d.ts +1 -1
  165. package/VideoConfig.d.mts +15 -0
  166. package/Voxelizer.d.mts +58 -0
  167. package/Voxelizer.d.ts +4 -4
  168. package/WorldChunkView.d.mts +75 -0
  169. package/WorldChunkView.d.ts +2 -2
  170. package/WorldGenerator.d.mts +75 -0
  171. package/WorldGenerator.d.ts +75 -0
  172. package/WorldGenerator.mjs +255 -0
  173. package/WorldSink.d.mts +50 -0
  174. package/WorldSink.d.ts +2 -2
  175. package/WorldStream.d.mts +45 -0
  176. package/WorldStream.d.ts +2 -2
  177. package/WsPartitionHints.d.mts +29 -0
  178. package/WsPartitionHints.d.ts +1 -1
  179. package/WsProfile.d.mts +46 -0
  180. package/WsProfile.d.ts +1 -1
  181. package/WsRunResult.d.mts +83 -0
  182. package/WsRunResult.d.ts +5 -5
  183. package/WsSegmentJob.d.mts +28 -0
  184. package/WsSegmentJob.d.ts +1 -1
  185. package/diplomat-runtime.d.mts +15 -0
  186. package/index.d.mts +177 -0
  187. package/index.d.ts +106 -70
  188. package/index.mjs +37 -1
  189. package/nucleation.wasm +0 -0
  190. package/package.json +2 -1
@@ -0,0 +1,35 @@
1
+ // generated by diplomat-tool
2
+ import type { GeneratedChunkCoverage } from "./GeneratedChunkCoverage.mjs"
3
+ import type { NucleationError } from "./NucleationError.mjs"
4
+ import type { WorldChunkView } from "./WorldChunkView.mjs"
5
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
6
+
7
+
8
+
9
+ /**
10
+ * One generated chunk plus coverage and source-version metadata.
11
+ * Call `take_view` once to move its chunk into the existing world-stream API.
12
+ */
13
+ export class GeneratedChunk {
14
+ /** @internal */
15
+ get ffiValue(): pointer;
16
+ /** @internal */
17
+ constructor();
18
+
19
+
20
+ cx(): number;
21
+
22
+ cz(): number;
23
+
24
+ coverage(): GeneratedChunkCoverage;
25
+
26
+ sourceId(): string;
27
+
28
+ version(): string;
29
+
30
+ /**
31
+ * Consume the generated chunk payload. Metadata access and a second call
32
+ * return `AlreadyConsumed` afterwards.
33
+ */
34
+ takeView(): WorldChunkView;
35
+ }
@@ -0,0 +1,178 @@
1
+ // generated by diplomat-tool
2
+ import { GeneratedChunkCoverage } from "./GeneratedChunkCoverage.mjs"
3
+ import { NucleationError } from "./NucleationError.mjs"
4
+ import { WorldChunkView } from "./WorldChunkView.mjs"
5
+ import wasm from "./diplomat-wasm.mjs";
6
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
7
+
8
+ const GeneratedChunk_box_destroy_registry = new FinalizationRegistry((ptr) => {
9
+ wasm.GeneratedChunk_destroy(ptr);
10
+ });
11
+
12
+ /**
13
+ * One generated chunk plus coverage and source-version metadata.
14
+ * Call `take_view` once to move its chunk into the existing world-stream API.
15
+ */
16
+ export class GeneratedChunk {
17
+ // Internal ptr reference:
18
+ #ptr = null;
19
+
20
+ // Lifetimes are only to keep dependencies alive.
21
+ // Since JS won't garbage collect until there are no incoming edges.
22
+ #selfEdge = [];
23
+
24
+ #internalConstructor(symbol, ptr, selfEdge) {
25
+ if (symbol !== diplomatRuntime.internalConstructor) {
26
+ console.error("GeneratedChunk is an Opaque type. You cannot call its constructor.");
27
+ return;
28
+ }
29
+ this.#ptr = ptr;
30
+ this.#selfEdge = selfEdge;
31
+
32
+ // Are we being borrowed? If not, we can register.
33
+ if (this.#selfEdge.length === 0) {
34
+ GeneratedChunk_box_destroy_registry.register(this, this.#ptr);
35
+ }
36
+
37
+ return this;
38
+ }
39
+ /** @internal */
40
+ get ffiValue() {
41
+ return this.#ptr;
42
+ }
43
+
44
+
45
+ cx() {
46
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
47
+
48
+
49
+ const result = wasm.GeneratedChunk_cx(diplomatReceive.buffer, this.ffiValue);
50
+
51
+ try {
52
+ if (!diplomatReceive.resultFlag) {
53
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
54
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
55
+ }
56
+ return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
57
+ }
58
+
59
+ finally {
60
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
61
+ diplomatReceive.free();
62
+ }
63
+ }
64
+
65
+ cz() {
66
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
67
+
68
+
69
+ const result = wasm.GeneratedChunk_cz(diplomatReceive.buffer, this.ffiValue);
70
+
71
+ try {
72
+ if (!diplomatReceive.resultFlag) {
73
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
74
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
75
+ }
76
+ return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
77
+ }
78
+
79
+ finally {
80
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
81
+ diplomatReceive.free();
82
+ }
83
+ }
84
+
85
+ coverage() {
86
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
87
+
88
+
89
+ const result = wasm.GeneratedChunk_coverage(diplomatReceive.buffer, this.ffiValue);
90
+
91
+ try {
92
+ if (!diplomatReceive.resultFlag) {
93
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
94
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
95
+ }
96
+ return new GeneratedChunkCoverage(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
97
+ }
98
+
99
+ finally {
100
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
101
+ diplomatReceive.free();
102
+ }
103
+ }
104
+
105
+ sourceId() {
106
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
107
+
108
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
109
+
110
+
111
+ const result = wasm.GeneratedChunk_source_id(diplomatReceive.buffer, this.ffiValue, write.buffer);
112
+
113
+ try {
114
+ if (!diplomatReceive.resultFlag) {
115
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
116
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
117
+ }
118
+ return write.readString8();
119
+ }
120
+
121
+ finally {
122
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
123
+ diplomatReceive.free();
124
+ write.free();
125
+ }
126
+ }
127
+
128
+ version() {
129
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
130
+
131
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
132
+
133
+
134
+ const result = wasm.GeneratedChunk_version(diplomatReceive.buffer, this.ffiValue, write.buffer);
135
+
136
+ try {
137
+ if (!diplomatReceive.resultFlag) {
138
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
139
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
140
+ }
141
+ return write.readString8();
142
+ }
143
+
144
+ finally {
145
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
146
+ diplomatReceive.free();
147
+ write.free();
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Consume the generated chunk payload. Metadata access and a second call
153
+ * return `AlreadyConsumed` afterwards.
154
+ */
155
+ takeView() {
156
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
157
+
158
+
159
+ const result = wasm.GeneratedChunk_take_view(diplomatReceive.buffer, this.ffiValue);
160
+
161
+ try {
162
+ if (!diplomatReceive.resultFlag) {
163
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
164
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
165
+ }
166
+ return new WorldChunkView(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
167
+ }
168
+
169
+ finally {
170
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
171
+ diplomatReceive.free();
172
+ }
173
+ }
174
+
175
+ constructor(symbol, ptr, selfEdge) {
176
+ return this.#internalConstructor(...arguments)
177
+ }
178
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Coverage of a generated chunk by its source graph.
8
+ */
9
+ export class GeneratedChunkCoverage {
10
+
11
+ /** @internal */
12
+ static fromValue(value: GeneratedChunkCoverage | string): GeneratedChunkCoverage;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Complete : GeneratedChunkCoverage;
20
+ static Partial : GeneratedChunkCoverage;
21
+ static Outside : GeneratedChunkCoverage;
22
+
23
+
24
+ constructor(value: GeneratedChunkCoverage | string );
25
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Coverage of a generated chunk by its source graph.
8
+ */
9
+ export class GeneratedChunkCoverage {
10
+
11
+ /** @internal */
12
+ static fromValue(value: GeneratedChunkCoverage | string): GeneratedChunkCoverage;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Complete : GeneratedChunkCoverage;
20
+ static Partial : GeneratedChunkCoverage;
21
+ static Outside : GeneratedChunkCoverage;
22
+
23
+
24
+ constructor(value: GeneratedChunkCoverage | string );
25
+ }
@@ -0,0 +1,75 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * Coverage of a generated chunk by its source graph.
9
+ */
10
+ export class GeneratedChunkCoverage {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Complete", 0],
15
+ ["Partial", 1],
16
+ ["Outside", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return GeneratedChunkCoverage.#values.entries();
21
+ }
22
+
23
+ #internalConstructor(value) {
24
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
25
+ // We pass in two internalConstructor arguments to create *new*
26
+ // instances of this type, otherwise the enums are treated as singletons.
27
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
28
+ this.#value = arguments[2];
29
+ return this;
30
+ }
31
+ return GeneratedChunkCoverage.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof GeneratedChunkCoverage) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = GeneratedChunkCoverage.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return GeneratedChunkCoverage.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a GeneratedChunkCoverage and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new GeneratedChunkCoverage(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...GeneratedChunkCoverage.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new GeneratedChunkCoverage(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new GeneratedChunkCoverage(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new GeneratedChunkCoverage(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ static Complete = GeneratedChunkCoverage.#objectValues[0];
68
+ static Partial = GeneratedChunkCoverage.#objectValues[1];
69
+ static Outside = GeneratedChunkCoverage.#objectValues[2];
70
+
71
+
72
+ constructor(value) {
73
+ return this.#internalConstructor(...arguments)
74
+ }
75
+ }
@@ -0,0 +1,24 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * How a composite layer treats non-air blocks already emitted by earlier layers.
8
+ */
9
+ export class GeneratedChunkOverlayMode {
10
+
11
+ /** @internal */
12
+ static fromValue(value: GeneratedChunkOverlayMode | string): GeneratedChunkOverlayMode;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Replace : GeneratedChunkOverlayMode;
20
+ static KeepExisting : GeneratedChunkOverlayMode;
21
+
22
+
23
+ constructor(value: GeneratedChunkOverlayMode | string );
24
+ }
@@ -0,0 +1,24 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * How a composite layer treats non-air blocks already emitted by earlier layers.
8
+ */
9
+ export class GeneratedChunkOverlayMode {
10
+
11
+ /** @internal */
12
+ static fromValue(value: GeneratedChunkOverlayMode | string): GeneratedChunkOverlayMode;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Replace : GeneratedChunkOverlayMode;
20
+ static KeepExisting : GeneratedChunkOverlayMode;
21
+
22
+
23
+ constructor(value: GeneratedChunkOverlayMode | string );
24
+ }
@@ -0,0 +1,72 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * How a composite layer treats non-air blocks already emitted by earlier layers.
9
+ */
10
+ export class GeneratedChunkOverlayMode {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Replace", 0],
15
+ ["KeepExisting", 1]
16
+ ]);
17
+
18
+ static getAllEntries() {
19
+ return GeneratedChunkOverlayMode.#values.entries();
20
+ }
21
+
22
+ #internalConstructor(value) {
23
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
24
+ // We pass in two internalConstructor arguments to create *new*
25
+ // instances of this type, otherwise the enums are treated as singletons.
26
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
27
+ this.#value = arguments[2];
28
+ return this;
29
+ }
30
+ return GeneratedChunkOverlayMode.#objectValues[arguments[1]];
31
+ }
32
+
33
+ if (value instanceof GeneratedChunkOverlayMode) {
34
+ return value;
35
+ }
36
+
37
+ let intVal = GeneratedChunkOverlayMode.#values.get(value);
38
+
39
+ // Nullish check, checks for null or undefined
40
+ if (intVal != null) {
41
+ return GeneratedChunkOverlayMode.#objectValues[intVal];
42
+ }
43
+
44
+ throw TypeError(value + " is not a GeneratedChunkOverlayMode and does not correspond to any of its enumerator values.");
45
+ }
46
+
47
+ /** @internal */
48
+ static fromValue(value) {
49
+ return new GeneratedChunkOverlayMode(value);
50
+ }
51
+
52
+ get value(){
53
+ return [...GeneratedChunkOverlayMode.#values.keys()][this.#value];
54
+ }
55
+
56
+ /** @internal */
57
+ get ffiValue(){
58
+ return this.#value;
59
+ }
60
+ static #objectValues = [
61
+ new GeneratedChunkOverlayMode(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
62
+ new GeneratedChunkOverlayMode(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
63
+ ];
64
+
65
+ static Replace = GeneratedChunkOverlayMode.#objectValues[0];
66
+ static KeepExisting = GeneratedChunkOverlayMode.#objectValues[1];
67
+
68
+
69
+ constructor(value) {
70
+ return this.#internalConstructor(...arguments)
71
+ }
72
+ }
@@ -0,0 +1,28 @@
1
+ // generated by diplomat-tool
2
+ import type { GeneratedChunk } from "./GeneratedChunk.mjs"
3
+ import type { NucleationError } from "./NucleationError.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * A finite, lazy, canonical region-major traversal of a generator.
10
+ */
11
+ export class GeneratedWorldStream {
12
+ /** @internal */
13
+ get ffiValue(): pointer;
14
+ /** @internal */
15
+ constructor();
16
+
17
+
18
+ /**
19
+ * Number of chunks not yet requested from the source.
20
+ */
21
+ remaining(): bigint;
22
+
23
+ /**
24
+ * Generate and return the next chunk. Returns `NotFound` at end-of-stream,
25
+ * and `Generation` if the underlying source failed on a valid request.
26
+ */
27
+ next(): GeneratedChunk;
28
+ }
@@ -0,0 +1,28 @@
1
+ // generated by diplomat-tool
2
+ import type { GeneratedChunk } from "./GeneratedChunk.mjs"
3
+ import type { NucleationError } from "./NucleationError.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * A finite, lazy, canonical region-major traversal of a generator.
10
+ */
11
+ export class GeneratedWorldStream {
12
+ /** @internal */
13
+ get ffiValue(): pointer;
14
+ /** @internal */
15
+ constructor();
16
+
17
+
18
+ /**
19
+ * Number of chunks not yet requested from the source.
20
+ */
21
+ remaining(): bigint;
22
+
23
+ /**
24
+ * Generate and return the next chunk. Returns `NotFound` at end-of-stream,
25
+ * and `Generation` if the underlying source failed on a valid request.
26
+ */
27
+ next(): GeneratedChunk;
28
+ }
@@ -0,0 +1,86 @@
1
+ // generated by diplomat-tool
2
+ import { GeneratedChunk } from "./GeneratedChunk.mjs"
3
+ import { NucleationError } from "./NucleationError.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const GeneratedWorldStream_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.GeneratedWorldStream_destroy(ptr);
9
+ });
10
+
11
+ /**
12
+ * A finite, lazy, canonical region-major traversal of a generator.
13
+ */
14
+ export class GeneratedWorldStream {
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("GeneratedWorldStream 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
+ GeneratedWorldStream_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
+ * Number of chunks not yet requested from the source.
45
+ */
46
+ remaining() {
47
+
48
+ const result = wasm.GeneratedWorldStream_remaining(this.ffiValue);
49
+
50
+ try {
51
+ return result;
52
+ }
53
+
54
+ finally {
55
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Generate and return the next chunk. Returns `NotFound` at end-of-stream,
61
+ * and `Generation` if the underlying source failed on a valid request.
62
+ */
63
+ next() {
64
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
65
+
66
+
67
+ const result = wasm.GeneratedWorldStream_next(diplomatReceive.buffer, this.ffiValue);
68
+
69
+ try {
70
+ if (!diplomatReceive.resultFlag) {
71
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
72
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
73
+ }
74
+ return new GeneratedChunk(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
75
+ }
76
+
77
+ finally {
78
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
79
+ diplomatReceive.free();
80
+ }
81
+ }
82
+
83
+ constructor(symbol, ptr, selfEdge) {
84
+ return this.#internalConstructor(...arguments)
85
+ }
86
+ }
package/Geo.d.mts ADDED
@@ -0,0 +1,41 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { Schematic } from "./Schematic.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * Namespace for the geodata entry points (no network — data goes in,
10
+ * blocks come out).
11
+ */
12
+ export class Geo {
13
+ /** @internal */
14
+ get ffiValue(): pointer;
15
+ /** @internal */
16
+ constructor();
17
+
18
+
19
+ /**
20
+ * Extrude building footprints into a massed schematic. `buildings_json`
21
+ * is a JSON array of objects:
22
+ * `{"polygon": [[x, z], ...], "height": <blocks>, "block": "minecraft:...",
23
+ * "min_y": <optional base, default 1>}`. Footprints are stamped
24
+ * tallest-last, so overlaps keep the tallest occupant per column.
25
+ * `base_block` (empty string = none) lays a ground slab at y=0 under the
26
+ * whole extent. Errors `Parse` on bad JSON, `InvalidArgument` on non-UTF-8.
27
+ */
28
+ static extrudeFootprints(buildingsJson: string, baseBlock: string, name: string): Schematic;
29
+
30
+ /**
31
+ * Raise terrain from a heightmap. `heights_json` is a flat row-major
32
+ * JSON array of per-column heights (blocks); `width` is columns per row.
33
+ * `surface_blocks_json` is a JSON array of block names — one entry (the
34
+ * same surface everywhere) or one per column, row-major and the same
35
+ * length as `heights`, for elevation/slope banding. Each column's top
36
+ * `surface_depth` blocks are its surface block, the rest are
37
+ * `subsurface_block`. Errors `Parse` on bad JSON, `InvalidArgument` on a
38
+ * non-positive width, empty surface list, or non-UTF-8.
39
+ */
40
+ static heightmapTerrain(heightsJson: string, width: number, surfaceBlocksJson: string, subsurfaceBlock: string, surfaceDepth: number, name: string): Schematic;
41
+ }
package/Geo.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
3
- import type { Schematic } from "./Schematic"
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { Schematic } from "./Schematic.mjs"
4
4
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
5
 
6
6
 
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Color interpolation space for gradient brushes. The old ABI passed this as
8
+ * `space: c_int` (`1` = Oklab, anything else = RGB).
9
+ */
10
+ export class InterpolationSpace {
11
+
12
+ /** @internal */
13
+ static fromValue(value: InterpolationSpace | string): InterpolationSpace;
14
+
15
+ get value(): string;
16
+
17
+ /** @internal */
18
+ get ffiValue(): number;
19
+
20
+ static Rgb : InterpolationSpace;
21
+ static Oklab : InterpolationSpace;
22
+
23
+
24
+ constructor(value: InterpolationSpace | string );
25
+ }