nucleation 0.2.18 → 0.3.1

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 (129) hide show
  1. package/Autostack.d.ts +43 -0
  2. package/Autostack.mjs +134 -0
  3. package/BlockPos.d.ts +28 -0
  4. package/BlockPos.mjs +129 -0
  5. package/BlockState.d.ts +39 -0
  6. package/BlockState.mjs +134 -0
  7. package/Brush.d.ts +68 -0
  8. package/Brush.mjs +220 -0
  9. package/BuildingTool.d.ts +29 -0
  10. package/BuildingTool.mjs +74 -0
  11. package/ChunkMeshResult.d.ts +75 -0
  12. package/ChunkMeshResult.mjs +253 -0
  13. package/CircuitBuilder.d.ts +118 -0
  14. package/CircuitBuilder.mjs +516 -0
  15. package/DefinitionRegion.d.ts +274 -0
  16. package/DefinitionRegion.mjs +973 -0
  17. package/Diff.d.ts +88 -0
  18. package/Diff.mjs +316 -0
  19. package/Dimensions.d.ts +28 -0
  20. package/Dimensions.mjs +129 -0
  21. package/ExecutionMode.d.ts +42 -0
  22. package/ExecutionMode.mjs +127 -0
  23. package/Fingerprint.d.ts +44 -0
  24. package/Fingerprint.mjs +197 -0
  25. package/InterpolationSpace.d.ts +25 -0
  26. package/InterpolationSpace.mjs +73 -0
  27. package/IoLayout.d.ts +26 -0
  28. package/IoLayout.mjs +81 -0
  29. package/IoLayoutBuilder.d.ts +73 -0
  30. package/IoLayoutBuilder.mjs +315 -0
  31. package/IoType.d.ts +41 -0
  32. package/IoType.mjs +125 -0
  33. package/ItemModelConfig.d.ts +65 -0
  34. package/ItemModelConfig.mjs +223 -0
  35. package/ItemModelPackBuilder.d.ts +32 -0
  36. package/ItemModelPackBuilder.mjs +104 -0
  37. package/ItemModelResult.d.ts +72 -0
  38. package/ItemModelResult.mjs +268 -0
  39. package/ItemScale.d.ts +31 -0
  40. package/ItemScale.mjs +132 -0
  41. package/LayoutFunction.d.ts +52 -0
  42. package/LayoutFunction.mjs +159 -0
  43. package/MchprsWorld.d.ts +131 -0
  44. package/MchprsWorld.mjs +423 -0
  45. package/MeshBounds.d.ts +40 -0
  46. package/MeshBounds.mjs +180 -0
  47. package/MeshConfig.d.ts +101 -0
  48. package/MeshConfig.mjs +306 -0
  49. package/MeshJob.d.ts +44 -0
  50. package/MeshJob.mjs +116 -0
  51. package/MeshPhase.d.ts +38 -0
  52. package/MeshPhase.mjs +90 -0
  53. package/MeshProgress.d.ts +32 -0
  54. package/MeshProgress.mjs +133 -0
  55. package/MeshResult.d.ts +60 -0
  56. package/MeshResult.mjs +206 -0
  57. package/MultiMeshResult.d.ts +50 -0
  58. package/MultiMeshResult.mjs +166 -0
  59. package/Nbt.d.ts +50 -0
  60. package/Nbt.mjs +161 -0
  61. package/NucleationError.d.ts +36 -0
  62. package/NucleationError.mjs +104 -0
  63. package/OutputCondition.d.ts +45 -0
  64. package/OutputCondition.mjs +129 -0
  65. package/Palette.d.ts +84 -0
  66. package/Palette.mjs +269 -0
  67. package/PaletteBuilder.d.ts +76 -0
  68. package/PaletteBuilder.mjs +297 -0
  69. package/README.md +28 -197
  70. package/RawMeshExport.d.ts +74 -0
  71. package/RawMeshExport.mjs +243 -0
  72. package/RedstoneGraph.d.ts +58 -0
  73. package/RedstoneGraph.mjs +242 -0
  74. package/RegionBounds.d.ts +41 -0
  75. package/RegionBounds.mjs +181 -0
  76. package/RenderConfig.d.ts +66 -0
  77. package/RenderConfig.mjs +170 -0
  78. package/Renderer.d.ts +35 -0
  79. package/Renderer.mjs +139 -0
  80. package/ResourcePack.d.ts +105 -0
  81. package/ResourcePack.mjs +447 -0
  82. package/ResourcePackList.d.ts +32 -0
  83. package/ResourcePackList.mjs +96 -0
  84. package/Schematic.d.ts +655 -0
  85. package/Schematic.mjs +2647 -0
  86. package/SchematicBuilder.d.ts +103 -0
  87. package/SchematicBuilder.mjs +401 -0
  88. package/SchematicRegions.d.ts +93 -0
  89. package/SchematicRegions.mjs +411 -0
  90. package/Scripting.d.ts +40 -0
  91. package/Scripting.mjs +138 -0
  92. package/Sdf.d.ts +31 -0
  93. package/Sdf.mjs +107 -0
  94. package/Shape.d.ts +108 -0
  95. package/Shape.mjs +336 -0
  96. package/SortStrategy.d.ts +86 -0
  97. package/SortStrategy.mjs +272 -0
  98. package/Store.d.ts +83 -0
  99. package/Store.mjs +369 -0
  100. package/StoreIo.d.ts +71 -0
  101. package/StoreIo.mjs +292 -0
  102. package/TextureAtlas.d.ts +40 -0
  103. package/TextureAtlas.mjs +122 -0
  104. package/TextureInfo.d.ts +34 -0
  105. package/TextureInfo.mjs +148 -0
  106. package/TypedCircuitExecutor.d.ts +101 -0
  107. package/TypedCircuitExecutor.mjs +378 -0
  108. package/Value.d.ts +73 -0
  109. package/Value.mjs +275 -0
  110. package/WorldChunkView.d.ts +63 -0
  111. package/WorldChunkView.mjs +201 -0
  112. package/WorldSink.d.ts +50 -0
  113. package/WorldSink.mjs +177 -0
  114. package/WorldStream.d.ts +45 -0
  115. package/WorldStream.mjs +184 -0
  116. package/diplomat-runtime.d.ts +15 -0
  117. package/diplomat-runtime.mjs +774 -0
  118. package/diplomat-wasm.mjs +52 -0
  119. package/diplomat.config.mjs +6 -0
  120. package/index.d.ts +117 -0
  121. package/index.mjs +120 -0
  122. package/{nucleation_bg.wasm → nucleation.wasm} +0 -0
  123. package/package.json +19 -41
  124. package/LICENSE +0 -21
  125. package/api.js +0 -608
  126. package/nucleation-cdn-loader.js +0 -15
  127. package/nucleation-original.js +0 -8383
  128. package/nucleation.d.ts +0 -2947
  129. package/nucleation.js +0 -36
package/Palette.mjs ADDED
@@ -0,0 +1,269 @@
1
+ // generated by diplomat-tool
2
+ import { NucleationError } from "./NucleationError.mjs"
3
+ import wasm from "./diplomat-wasm.mjs";
4
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
5
+
6
+ const Palette_box_destroy_registry = new FinalizationRegistry((ptr) => {
7
+ wasm.Palette_destroy(ptr);
8
+ });
9
+
10
+ /**
11
+ * A set of colored blocks that color/gradient brushes snap their computed
12
+ * colors to (nearest neighbor in Oklab space). Wraps an Arc'd
13
+ * {@link crate::building::BlockPalette}; sharing one palette across many
14
+ * brushes is cheap.
15
+ */
16
+ export class Palette {
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("Palette 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
+ Palette_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
+ /**
46
+ * Every block blockpedia knows a color for (the default palette
47
+ * brushes use when none is set).
48
+ */
49
+ static all() {
50
+
51
+ const result = wasm.Palette_all();
52
+
53
+ try {
54
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Only solid blocks: no transparency, gravity, tile entities, or
64
+ * support requirements.
65
+ */
66
+ static solid() {
67
+
68
+ const result = wasm.Palette_solid();
69
+
70
+ try {
71
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
72
+ }
73
+
74
+ finally {
75
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Conservative structural set (full building blocks).
81
+ */
82
+ static structural() {
83
+
84
+ const result = wasm.Palette_structural();
85
+
86
+ try {
87
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
88
+ }
89
+
90
+ finally {
91
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Decorative set: allows stairs/slabs but no tile entities.
97
+ */
98
+ static decorative() {
99
+
100
+ const result = wasm.Palette_decorative();
101
+
102
+ try {
103
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
104
+ }
105
+
106
+ finally {
107
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
108
+ }
109
+ }
110
+
111
+ /**
112
+ * The 16 concrete colors (excludes concrete powder).
113
+ */
114
+ static concrete() {
115
+
116
+ const result = wasm.Palette_concrete();
117
+
118
+ try {
119
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
120
+ }
121
+
122
+ finally {
123
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
124
+ }
125
+ }
126
+
127
+ /**
128
+ * The 16 wool colors.
129
+ */
130
+ static wool() {
131
+
132
+ const result = wasm.Palette_wool();
133
+
134
+ try {
135
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
136
+ }
137
+
138
+ finally {
139
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Terracotta colors (excludes glazed variants).
145
+ */
146
+ static terracotta() {
147
+
148
+ const result = wasm.Palette_terracotta();
149
+
150
+ try {
151
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
152
+ }
153
+
154
+ finally {
155
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Grayscale-leaning blocks (stones, basalt, deepslate, ...).
161
+ */
162
+ static grayscale() {
163
+
164
+ const result = wasm.Palette_grayscale();
165
+
166
+ try {
167
+ return new Palette(diplomatRuntime.internalConstructor, result, []);
168
+ }
169
+
170
+ finally {
171
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Custom palette from a JSON array of block ids, e.g.
177
+ * `["minecraft:stone", "minecraft:oak_planks"]`. Ids blockpedia has
178
+ * no color for are silently skipped — check `len` afterwards.
179
+ */
180
+ static fromBlockIds(idsJson) {
181
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
182
+
183
+ const idsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, idsJson)));
184
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
185
+
186
+
187
+ const result = wasm.Palette_from_block_ids(diplomatReceive.buffer, idsJsonSlice.ptr);
188
+
189
+ try {
190
+ if (!diplomatReceive.resultFlag) {
191
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
192
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
193
+ }
194
+ return new Palette(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
195
+ }
196
+
197
+ finally {
198
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
199
+ functionCleanupArena.free();
200
+
201
+ diplomatReceive.free();
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Number of blocks in the palette.
207
+ */
208
+ len() {
209
+
210
+ const result = wasm.Palette_len(this.ffiValue);
211
+
212
+ try {
213
+ return result;
214
+ }
215
+
216
+ finally {
217
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
218
+ }
219
+ }
220
+
221
+ /**
222
+ * The palette's block ids as a JSON array string.
223
+ */
224
+ blockIdsJson() {
225
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
226
+
227
+ wasm.Palette_block_ids_json(this.ffiValue, write.buffer);
228
+
229
+ try {
230
+ return write.readString8();
231
+ }
232
+
233
+ finally {
234
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
235
+ write.free();
236
+ }
237
+ }
238
+
239
+ /**
240
+ * The palette block whose color is closest (Oklab distance) to the
241
+ * given RGB. Errors with `NotFound` on an empty palette.
242
+ */
243
+ closestBlock(r, g, b) {
244
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
245
+
246
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
247
+
248
+
249
+ const result = wasm.Palette_closest_block(diplomatReceive.buffer, this.ffiValue, r, g, b, write.buffer);
250
+
251
+ try {
252
+ if (!diplomatReceive.resultFlag) {
253
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
254
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
255
+ }
256
+ return write.readString8();
257
+ }
258
+
259
+ finally {
260
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
261
+ diplomatReceive.free();
262
+ write.free();
263
+ }
264
+ }
265
+
266
+ constructor(symbol, ptr, selfEdge) {
267
+ return this.#internalConstructor(...arguments)
268
+ }
269
+ }
@@ -0,0 +1,76 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError"
3
+ import type { Palette } from "./Palette"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * Filter-driven palette construction (wraps
10
+ * {@link crate::building::PaletteBuilder}, which fronts blockpedia's
11
+ * `BlockFilter`). Call flag methods, then `build` — the builder is
12
+ * consumed; further calls error with `AlreadyConsumed`.
13
+ */
14
+ export class PaletteBuilder {
15
+ /** @internal */
16
+ get ffiValue(): pointer;
17
+ /** @internal */
18
+ constructor();
19
+
20
+
21
+ /**
22
+ * A builder matching every colored block (no filters yet).
23
+ */
24
+ static create(): PaletteBuilder;
25
+
26
+ /**
27
+ * Exclude gravity-affected blocks (sand, gravel, ...).
28
+ */
29
+ excludeFalling(): void;
30
+
31
+ /**
32
+ * Exclude blocks with block entities (chests, furnaces, ...).
33
+ */
34
+ excludeTileEntities(): void;
35
+
36
+ /**
37
+ * Keep only full cube blocks (no stairs, slabs, fences, ...).
38
+ */
39
+ fullBlocksOnly(): void;
40
+
41
+ /**
42
+ * Exclude blocks that need supporting blocks (torches, rails, ...).
43
+ */
44
+ excludeNeedsSupport(): void;
45
+
46
+ /**
47
+ * Exclude transparent/translucent blocks (glass, leaves, ...).
48
+ */
49
+ excludeTransparent(): void;
50
+
51
+ /**
52
+ * Exclude light-emitting blocks (glowstone, lanterns, ...).
53
+ */
54
+ excludeLightSources(): void;
55
+
56
+ /**
57
+ * Keep only blocks obtainable in survival.
58
+ */
59
+ survivalOnly(): void;
60
+
61
+ /**
62
+ * Exclude blocks whose id contains `keyword`.
63
+ */
64
+ excludeKeyword(keyword: string): void;
65
+
66
+ /**
67
+ * Keep only blocks whose id contains `keyword` (repeatable; matches
68
+ * any of the included keywords).
69
+ */
70
+ includeKeyword(keyword: string): void;
71
+
72
+ /**
73
+ * Build the palette; consumes the builder.
74
+ */
75
+ build(): Palette;
76
+ }
@@ -0,0 +1,297 @@
1
+ // generated by diplomat-tool
2
+ import { NucleationError } from "./NucleationError.mjs"
3
+ import { Palette } from "./Palette.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const PaletteBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.PaletteBuilder_destroy(ptr);
9
+ });
10
+
11
+ /**
12
+ * Filter-driven palette construction (wraps
13
+ * {@link crate::building::PaletteBuilder}, which fronts blockpedia's
14
+ * `BlockFilter`). Call flag methods, then `build` — the builder is
15
+ * consumed; further calls error with `AlreadyConsumed`.
16
+ */
17
+ export class PaletteBuilder {
18
+ // Internal ptr reference:
19
+ #ptr = null;
20
+
21
+ // Lifetimes are only to keep dependencies alive.
22
+ // Since JS won't garbage collect until there are no incoming edges.
23
+ #selfEdge = [];
24
+
25
+ #internalConstructor(symbol, ptr, selfEdge) {
26
+ if (symbol !== diplomatRuntime.internalConstructor) {
27
+ console.error("PaletteBuilder is an Opaque type. You cannot call its constructor.");
28
+ return;
29
+ }
30
+ this.#ptr = ptr;
31
+ this.#selfEdge = selfEdge;
32
+
33
+ // Are we being borrowed? If not, we can register.
34
+ if (this.#selfEdge.length === 0) {
35
+ PaletteBuilder_box_destroy_registry.register(this, this.#ptr);
36
+ }
37
+
38
+ return this;
39
+ }
40
+ /** @internal */
41
+ get ffiValue() {
42
+ return this.#ptr;
43
+ }
44
+
45
+
46
+ /**
47
+ * A builder matching every colored block (no filters yet).
48
+ */
49
+ static create() {
50
+
51
+ const result = wasm.PaletteBuilder_create();
52
+
53
+ try {
54
+ return new PaletteBuilder(diplomatRuntime.internalConstructor, result, []);
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Exclude gravity-affected blocks (sand, gravel, ...).
64
+ */
65
+ excludeFalling() {
66
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
67
+
68
+
69
+ const result = wasm.PaletteBuilder_exclude_falling(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
+ }
77
+
78
+ finally {
79
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
80
+ diplomatReceive.free();
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Exclude blocks with block entities (chests, furnaces, ...).
86
+ */
87
+ excludeTileEntities() {
88
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
89
+
90
+
91
+ const result = wasm.PaletteBuilder_exclude_tile_entities(diplomatReceive.buffer, this.ffiValue);
92
+
93
+ try {
94
+ if (!diplomatReceive.resultFlag) {
95
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
96
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
97
+ }
98
+ }
99
+
100
+ finally {
101
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
102
+ diplomatReceive.free();
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Keep only full cube blocks (no stairs, slabs, fences, ...).
108
+ */
109
+ fullBlocksOnly() {
110
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
111
+
112
+
113
+ const result = wasm.PaletteBuilder_full_blocks_only(diplomatReceive.buffer, this.ffiValue);
114
+
115
+ try {
116
+ if (!diplomatReceive.resultFlag) {
117
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
118
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
119
+ }
120
+ }
121
+
122
+ finally {
123
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
124
+ diplomatReceive.free();
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Exclude blocks that need supporting blocks (torches, rails, ...).
130
+ */
131
+ excludeNeedsSupport() {
132
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
133
+
134
+
135
+ const result = wasm.PaletteBuilder_exclude_needs_support(diplomatReceive.buffer, this.ffiValue);
136
+
137
+ try {
138
+ if (!diplomatReceive.resultFlag) {
139
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
140
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
141
+ }
142
+ }
143
+
144
+ finally {
145
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
146
+ diplomatReceive.free();
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Exclude transparent/translucent blocks (glass, leaves, ...).
152
+ */
153
+ excludeTransparent() {
154
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
155
+
156
+
157
+ const result = wasm.PaletteBuilder_exclude_transparent(diplomatReceive.buffer, this.ffiValue);
158
+
159
+ try {
160
+ if (!diplomatReceive.resultFlag) {
161
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
162
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
163
+ }
164
+ }
165
+
166
+ finally {
167
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
168
+ diplomatReceive.free();
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Exclude light-emitting blocks (glowstone, lanterns, ...).
174
+ */
175
+ excludeLightSources() {
176
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
177
+
178
+
179
+ const result = wasm.PaletteBuilder_exclude_light_sources(diplomatReceive.buffer, this.ffiValue);
180
+
181
+ try {
182
+ if (!diplomatReceive.resultFlag) {
183
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
184
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
185
+ }
186
+ }
187
+
188
+ finally {
189
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
190
+ diplomatReceive.free();
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Keep only blocks obtainable in survival.
196
+ */
197
+ survivalOnly() {
198
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
199
+
200
+
201
+ const result = wasm.PaletteBuilder_survival_only(diplomatReceive.buffer, this.ffiValue);
202
+
203
+ try {
204
+ if (!diplomatReceive.resultFlag) {
205
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
206
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
207
+ }
208
+ }
209
+
210
+ finally {
211
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
212
+ diplomatReceive.free();
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Exclude blocks whose id contains `keyword`.
218
+ */
219
+ excludeKeyword(keyword) {
220
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
221
+
222
+ const keywordSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, keyword)));
223
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
224
+
225
+
226
+ const result = wasm.PaletteBuilder_exclude_keyword(diplomatReceive.buffer, this.ffiValue, keywordSlice.ptr);
227
+
228
+ try {
229
+ if (!diplomatReceive.resultFlag) {
230
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
231
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
232
+ }
233
+ }
234
+
235
+ finally {
236
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
237
+ functionCleanupArena.free();
238
+
239
+ diplomatReceive.free();
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Keep only blocks whose id contains `keyword` (repeatable; matches
245
+ * any of the included keywords).
246
+ */
247
+ includeKeyword(keyword) {
248
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
249
+
250
+ const keywordSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, keyword)));
251
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
252
+
253
+
254
+ const result = wasm.PaletteBuilder_include_keyword(diplomatReceive.buffer, this.ffiValue, keywordSlice.ptr);
255
+
256
+ try {
257
+ if (!diplomatReceive.resultFlag) {
258
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
259
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
260
+ }
261
+ }
262
+
263
+ finally {
264
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
265
+ functionCleanupArena.free();
266
+
267
+ diplomatReceive.free();
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Build the palette; consumes the builder.
273
+ */
274
+ build() {
275
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
276
+
277
+
278
+ const result = wasm.PaletteBuilder_build(diplomatReceive.buffer, this.ffiValue);
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 new Palette(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
286
+ }
287
+
288
+ finally {
289
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
290
+ diplomatReceive.free();
291
+ }
292
+ }
293
+
294
+ constructor(symbol, ptr, selfEdge) {
295
+ return this.#internalConstructor(...arguments)
296
+ }
297
+ }