nucleation 0.5.1 → 0.7.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,44 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+
6
+
7
+ /**
8
+ * A reusable set of property tracks, modelled after Anime.js object animations.
9
+ */
10
+ export class AnimationEffect {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ static create(durationMs: number): AnimationEffect;
18
+
19
+ static instant(): AnimationEffect;
20
+
21
+ static popIn(durationMs: number): AnimationEffect;
22
+
23
+ static dropIn(durationMs: number, height: number): AnimationEffect;
24
+
25
+ static dropAndPop(durationMs: number, height: number): AnimationEffect;
26
+
27
+ static spinIn(durationMs: number, turns: number): AnimationEffect;
28
+
29
+ static turntable(durationMs: number): AnimationEffect;
30
+
31
+ /**
32
+ * Add a two-key property tween. Property names follow Anime.js/Three.js:
33
+ * `x`, `y`, `z`, `rotateX`, `rotateY`, `rotateZ`, `scale`, `opacity`,
34
+ * `tintR/G/B/A`, and `emissiveR/G/B`.
35
+ */
36
+ addTween(propertyName: string, from: number, to: number, easingName: string): void;
37
+
38
+ /**
39
+ * Add a normalised keyframe (`at` in `0..=1`) to a property track.
40
+ */
41
+ addKeyframe(propertyName: string, at: number, value: number, easingName: string): void;
42
+
43
+ setRepeatForever(): void;
44
+ }
@@ -1,5 +1,5 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
3
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
4
 
5
5
 
@@ -0,0 +1,43 @@
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
+ * Free functions in the old ABI hung directly off `schematic_*`; here they get a
10
+ * namespacing opaque-less home via static methods on a zero-size type is not
11
+ * supported, so they live as static methods taking `&Schematic` explicitly.
12
+ */
13
+ export class Autostack {
14
+ /** @internal */
15
+ get ffiValue(): pointer;
16
+ /** @internal */
17
+ constructor();
18
+
19
+
20
+ /**
21
+ * Detect repeating structures (region coverage). Writes a JSON array string;
22
+ * each element has `mode`, `vectors`, `coverage`, `region_min`/`region_max`,
23
+ * `cell_min`/`cell_max`, `label`.
24
+ */
25
+ static detectStructures(schematic: Schematic): string;
26
+
27
+ /**
28
+ * Graph-based detection: recovers diagonal lattice periods via the redstone
29
+ * logic graph. Writes `"[]"` for non-redstone builds. Requires the
30
+ * `simulation` feature; writes `"[]"` when compiled without it.
31
+ */
32
+ static detectStructuresGraph(schematic: Schematic): string;
33
+
34
+ /**
35
+ * Resize a 1D / diagonal structure along its period vector.
36
+ */
37
+ static resize1d(schematic: Schematic, vx: number, vy: number, vz: number, units: number): Schematic;
38
+
39
+ /**
40
+ * Resize a 2D structure to `n1`×`n2` cells along the two period vectors.
41
+ */
42
+ static resize2d(schematic: Schematic, v1x: number, v1y: number, v1z: number, v2x: number, v2y: number, v2z: number, n1: number, n2: number): Schematic;
43
+ }
package/Autostack.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
 
package/BlockPos.d.mts ADDED
@@ -0,0 +1,28 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type BlockPos_obj = {
5
+ x: number;
6
+ y: number;
7
+ z: number;
8
+ };
9
+
10
+
11
+
12
+ export class BlockPos {
13
+ get x(): number;
14
+ set x(value: number);
15
+ get y(): number;
16
+ set y(value: number);
17
+ get z(): number;
18
+ set z(value: number);
19
+ /** @internal */
20
+ static fromFields(structObj : BlockPos_obj) : BlockPos;
21
+
22
+ /**
23
+ * Create `BlockPos` from an object that contains all of `BlockPos`s fields.
24
+ * Optional fields do not need to be included in the provided object.
25
+ */
26
+ constructor(structObj: BlockPos_obj);
27
+
28
+ }
@@ -0,0 +1,39 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+
6
+
7
+ /**
8
+ * A block state: a block name plus its properties. Port of the old
9
+ * `BlockStateWrapper` / `blockstate_*` fns.
10
+ */
11
+ export class BlockState {
12
+ /** @internal */
13
+ get ffiValue(): pointer;
14
+ /** @internal */
15
+ constructor();
16
+
17
+
18
+ /**
19
+ * Create a block state with the given name and no properties.
20
+ */
21
+ static create(name: string): BlockState;
22
+
23
+ /**
24
+ * A copy of this block state with `key=value` set; the original is
25
+ * unchanged.
26
+ */
27
+ withProperty(key: string, value: string): BlockState;
28
+
29
+ /**
30
+ * The block name (e.g. `minecraft:stone`).
31
+ */
32
+ name(): string;
33
+
34
+ /**
35
+ * The properties as a JSON object of string→string (the old
36
+ * `CPropertyArray`).
37
+ */
38
+ propertiesJson(): string;
39
+ }
package/BlockState.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
3
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
4
 
5
5
 
package/Blocks.d.mts ADDED
@@ -0,0 +1,91 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+
6
+
7
+ /**
8
+ * Namespace for read-only queries over the built-in block table
9
+ * (Java 26.2 blocks + official semantics extracted from the vanilla
10
+ * jars: definition kinds, base-block links, block tags, model
11
+ * geometry). All list results are JSON array strings sorted by id;
12
+ * block/tag/kind arguments accept both `minecraft:`-prefixed and
13
+ * short forms (`minecraft:oak_stairs` / `oak_stairs`).
14
+ */
15
+ export class Blocks {
16
+ /** @internal */
17
+ get ffiValue(): pointer;
18
+ /** @internal */
19
+ constructor();
20
+
21
+
22
+ /**
23
+ * Full facts for one block as a JSON object:
24
+ * `{id, kind, base_block, tags: [...], full_cube, transparent,
25
+ * color: [r, g, b] | null, properties: {name: [values...]},
26
+ * default_state: {name: value}}`. `kind` is the official
27
+ * definition kind (`minecraft:stair`, plain full blocks are
28
+ * `minecraft:block`); `base_block` is the block this one is a
29
+ * shape variant of (or `null`); `color` is the texture-derived
30
+ * average RGB. Errors with `NotFound` for unknown ids.
31
+ */
32
+ static getJson(id: string): string;
33
+
34
+ /**
35
+ * All known block ids as a sorted JSON array string.
36
+ */
37
+ static idsJson(): string;
38
+
39
+ /**
40
+ * Ids of every block carrying the vanilla block tag, as a sorted
41
+ * Blocks whose measured texture color is within `max_distance`
42
+ * (Oklab; ~0.05 = same color family, ~0.15 = generous) of the given
43
+ * RGB, as a JSON array of `{"id", "color": [r,g,b], "distance"}`
44
+ * sorted nearest-first. Blocks without color data never match.
45
+ */
46
+ static byColorJson(r: number, g: number, b: number, maxDistance: number): string;
47
+
48
+ /**
49
+ * JSON array string (`[]` for unknown tags). Accepts
50
+ * `minecraft:wool` and short `wool` forms, including nested paths
51
+ * like `mineable/pickaxe`.
52
+ */
53
+ static byTagJson(tag: string): string;
54
+
55
+ /**
56
+ * Ids of every block of the given official definition kind
57
+ * (`minecraft:stair`, `minecraft:slab`, `minecraft:door`, ...), as
58
+ * a sorted JSON array string (`[]` for unknown kinds).
59
+ */
60
+ static byKindJson(kind: string): string;
61
+
62
+ /**
63
+ * The base block followed by all its shape variants — blocks whose
64
+ * `base_block` is `base_id` (stairs, slabs, walls, fences of the
65
+ * base) — as a JSON array string. The base itself is always first;
66
+ * variants follow sorted by id. Errors with `NotFound` for unknown
67
+ * base ids.
68
+ */
69
+ static variantsOfJson(baseId: string): string;
70
+
71
+ /**
72
+ * All known vanilla block tag names as a sorted JSON array string
73
+ * (`minecraft:`-prefixed, e.g. `minecraft:wool`).
74
+ */
75
+ static tagsJson(): string;
76
+
77
+ /**
78
+ * Every property-value combination of the block as a JSON array of
79
+ * `{prop: value}` objects (a single `{}` entry for property-less
80
+ * blocks). Errors with `NotFound` for unknown ids and with
81
+ * `InvalidArgument` if the combination count exceeds 4096 (guard
82
+ * against pathological output; the current data tops out at 1350
83
+ * for `minecraft:note_block`).
84
+ */
85
+ static statesJson(id: string): string;
86
+
87
+ /**
88
+ * Total number of blocks in the table.
89
+ */
90
+ static count(): number;
91
+ }
package/Blocks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
3
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
4
 
5
5
 
package/Brush.d.mts ADDED
@@ -0,0 +1,99 @@
1
+ // generated by diplomat-tool
2
+ import type { Field3 } from "./Field3.mjs"
3
+ import type { InterpolationSpace } from "./InterpolationSpace.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Palette } from "./Palette.mjs"
6
+ import type { Sdf } from "./Sdf.mjs"
7
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
8
+
9
+
10
+
11
+ /**
12
+ * Decides which block goes at each point of a filled shape. Wraps `BrushEnum`.
13
+ */
14
+ export class Brush {
15
+ /** @internal */
16
+ get ffiValue(): pointer;
17
+ /** @internal */
18
+ constructor();
19
+
20
+
21
+ /**
22
+ * Every point becomes `block_name` (a block-state string).
23
+ */
24
+ static solid(blockName: string): Brush;
25
+
26
+ /**
27
+ * Nearest-block-to-RGB-color brush.
28
+ */
29
+ static color(r: number, g: number, b: number): Brush;
30
+
31
+ /**
32
+ * Linear color gradient between two anchored points.
33
+ */
34
+ static linearGradient(x1: number, y1: number, z1: number, r1: number, g1: number, b1: number, x2: number, y2: number, z2: number, r2: number, g2: number, b2: number, space: InterpolationSpace): Brush;
35
+
36
+ /**
37
+ * Base color shaded by surface normal against light direction
38
+ * (`lx`, `ly`, `lz`).
39
+ */
40
+ static shaded(r: number, g: number, b: number, lx: number, ly: number, lz: number): Brush;
41
+
42
+ /**
43
+ * Bilinear gradient over the patch `origin + s*u + t*v` with corner colors
44
+ * c00/c10/c01/c11.
45
+ */
46
+ static bilinearGradient(ox: number, oy: number, oz: number, ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, r00: number, g00: number, b00: number, r10: number, g10: number, b10: number, r01: number, g01: number, b01: number, r11: number, g11: number, b11: number, space: InterpolationSpace): Brush;
47
+
48
+ /**
49
+ * Inverse-distance-weighted gradient between colored anchor points.
50
+ * `positions` is flat `[x0, y0, z0, x1, …]` and `colors` is flat
51
+ * `[r0, g0, b0, r1, …]`; both must describe the same non-zero number of
52
+ * points (`positions.len() == colors.len()`, a multiple of 3).
53
+ */
54
+ static pointGradient(positions: Array<number>, colors: Array<number>, falloff: number, space: InterpolationSpace): Brush;
55
+
56
+ /**
57
+ * Spotlight-lit base color (`r`, `g`, `b`): Lambert shading toward a
58
+ * cone light at (`px`, `py`, `pz`) aimed along (`dx`, `dy`, `dz`).
59
+ * Full intensity inside 0.7 × `cone_angle_deg`, smoothstep falloff
60
+ * to zero at the cone edge; surfaces facing away or outside the cone
61
+ * drop to a 4% ambient floor.
62
+ */
63
+ static spotlight(px: number, py: number, pz: number, dx: number, dy: number, dz: number, coneAngleDeg: number, r: number, g: number, b: number): Brush;
64
+
65
+ /**
66
+ * Use `palette` for this brush's color→block snapping instead of the
67
+ * default all-blocks palette. No-op for `solid` brushes, which place
68
+ * a fixed block state. Set it before filling; the palette is shared,
69
+ * not copied.
70
+ */
71
+ setPalette(palette: Palette): void;
72
+
73
+ /**
74
+ * Gradient along a parametric curve: `stops` holds the curve parameters in
75
+ * `[0, 1]` and `colors` the matching flat RGB triples
76
+ * (`colors.len() == stops.len() * 3`, `stops` non-empty).
77
+ */
78
+ static curveGradient(stops: Array<number>, colors: Array<number>, space: InterpolationSpace): Brush;
79
+
80
+ /**
81
+ * Compatibility path that colors voxels by evaluating an SDF graph as
82
+ * a scalar field. Prefer `field3` for new code.
83
+ * `stops` are in `[0, 1]`; `colors` are flat RGB triples. The sampled
84
+ * value is remapped from `[lo, hi]` before reading the gradient.
85
+ */
86
+ static fieldSdf(field: Sdf, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
87
+
88
+ /**
89
+ * Color every voxel by evaluating a geometry-neutral scalar field at
90
+ * its center. The field is cloned into the brush, so both wrappers
91
+ * may be independently destroyed after construction.
92
+ */
93
+ static field3(field: Field3, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
94
+
95
+ /**
96
+ * Legacy JSON-first field brush. Prefer `field3` for new code.
97
+ */
98
+ static field(fieldJson: string, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
99
+ }
package/Brush.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  // generated by diplomat-tool
2
- import type { InterpolationSpace } from "./InterpolationSpace"
3
- import type { NucleationError } from "./NucleationError"
4
- import type { Palette } from "./Palette"
2
+ import type { Field3 } from "./Field3.mjs"
3
+ import type { InterpolationSpace } from "./InterpolationSpace.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Palette } from "./Palette.mjs"
6
+ import type { Sdf } from "./Sdf.mjs"
5
7
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
6
8
 
7
9
 
@@ -76,15 +78,22 @@ export class Brush {
76
78
  static curveGradient(stops: Array<number>, colors: Array<number>, space: InterpolationSpace): Brush;
77
79
 
78
80
  /**
79
- * A field brush: color every voxel by evaluating a scalar field at its
80
- * center, remapping `[lo, hi]` to `[0, 1]`, and reading a multi-stop
81
- * gradient (`stops` in `[0, 1]`, `colors` as flat RGB triples). The
82
- * field is any SDF JSON — the same language that builds geometry — so a
83
- * `cells` node paints a Voronoi mosaic (`mode: value`) or cracks
84
- * (`mode: f2MinusF1`), an fbm field a marble, a coordinate expression a
85
- * stripe. Call `set_palette` to choose the block set. Errors with
86
- * `Parse` on bad field JSON and `InvalidArgument` on a stops/colors
87
- * length mismatch.
81
+ * Compatibility path that colors voxels by evaluating an SDF graph as
82
+ * a scalar field. Prefer `field3` for new code.
83
+ * `stops` are in `[0, 1]`; `colors` are flat RGB triples. The sampled
84
+ * value is remapped from `[lo, hi]` before reading the gradient.
85
+ */
86
+ static fieldSdf(field: Sdf, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
87
+
88
+ /**
89
+ * Color every voxel by evaluating a geometry-neutral scalar field at
90
+ * its center. The field is cloned into the brush, so both wrappers
91
+ * may be independently destroyed after construction.
92
+ */
93
+ static field3(field: Field3, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
94
+
95
+ /**
96
+ * Legacy JSON-first field brush. Prefer `field3` for new code.
88
97
  */
89
98
  static field(fieldJson: string, stops: Array<number>, colors: Array<number>, lo: number, hi: number, space: InterpolationSpace): Brush;
90
99
  }
package/Brush.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  // generated by diplomat-tool
2
+ import { Field3 } from "./Field3.mjs"
2
3
  import { InterpolationSpace } from "./InterpolationSpace.mjs"
3
4
  import { NucleationError } from "./NucleationError.mjs"
4
5
  import { Palette } from "./Palette.mjs"
6
+ import { Sdf } from "./Sdf.mjs"
5
7
  import wasm from "./diplomat-wasm.mjs";
6
8
  import * as diplomatRuntime from "./diplomat-runtime.mjs";
7
9
 
@@ -235,15 +237,70 @@ export class Brush {
235
237
  }
236
238
 
237
239
  /**
238
- * A field brush: color every voxel by evaluating a scalar field at its
239
- * center, remapping `[lo, hi]` to `[0, 1]`, and reading a multi-stop
240
- * gradient (`stops` in `[0, 1]`, `colors` as flat RGB triples). The
241
- * field is any SDF JSON — the same language that builds geometry — so a
242
- * `cells` node paints a Voronoi mosaic (`mode: value`) or cracks
243
- * (`mode: f2MinusF1`), an fbm field a marble, a coordinate expression a
244
- * stripe. Call `set_palette` to choose the block set. Errors with
245
- * `Parse` on bad field JSON and `InvalidArgument` on a stops/colors
246
- * length mismatch.
240
+ * Compatibility path that colors voxels by evaluating an SDF graph as
241
+ * a scalar field. Prefer `field3` for new code.
242
+ * `stops` are in `[0, 1]`; `colors` are flat RGB triples. The sampled
243
+ * value is remapped from `[lo, hi]` before reading the gradient.
244
+ */
245
+ static fieldSdf(field, stops, colors, lo, hi, space) {
246
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
247
+
248
+ const stopsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, stops, "f32")));
249
+ const colorsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, colors, "u8")));
250
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
251
+
252
+
253
+ const result = wasm.Brush_field_sdf(diplomatReceive.buffer, field.ffiValue, stopsSlice.ptr, colorsSlice.ptr, lo, hi, space.ffiValue);
254
+
255
+ try {
256
+ if (!diplomatReceive.resultFlag) {
257
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
258
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
259
+ }
260
+ return new Brush(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
261
+ }
262
+
263
+ finally {
264
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
265
+ functionCleanupArena.free();
266
+
267
+ diplomatReceive.free();
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Color every voxel by evaluating a geometry-neutral scalar field at
273
+ * its center. The field is cloned into the brush, so both wrappers
274
+ * may be independently destroyed after construction.
275
+ */
276
+ static field3(field, stops, colors, lo, hi, space) {
277
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
278
+
279
+ const stopsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, stops, "f32")));
280
+ const colorsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, colors, "u8")));
281
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
282
+
283
+
284
+ const result = wasm.Brush_field3(diplomatReceive.buffer, field.ffiValue, stopsSlice.ptr, colorsSlice.ptr, lo, hi, space.ffiValue);
285
+
286
+ try {
287
+ if (!diplomatReceive.resultFlag) {
288
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
289
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
290
+ }
291
+ return new Brush(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
292
+ }
293
+
294
+ finally {
295
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
296
+ functionCleanupArena.free();
297
+
298
+ diplomatReceive.free();
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Legacy JSON-first field brush. Prefer `field3` for new code.
247
304
  */
248
305
  static field(fieldJson, stops, colors, lo, hi, space) {
249
306
  let functionCleanupArena = new diplomatRuntime.CleanupArena();
@@ -0,0 +1,142 @@
1
+ // generated by diplomat-tool
2
+ import type { AnimationEffect } from "./AnimationEffect.mjs"
3
+ import type { Brush } from "./Brush.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Schematic } from "./Schematic.mjs"
6
+ import type { Shape } from "./Shape.mjs"
7
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
8
+
9
+
10
+
11
+ /**
12
+ * A schematic wrapper that records construction calls as animation targets.
13
+ */
14
+ export class BuildAnimation {
15
+ /** @internal */
16
+ get ffiValue(): pointer;
17
+ /** @internal */
18
+ constructor();
19
+
20
+
21
+ static create(name: string): BuildAnimation;
22
+
23
+ /**
24
+ * Clone an existing schematic into one animation group. Entity-only
25
+ * schematics are supported; overlapping block/entity integer positions
26
+ * are rejected rather than silently dropping a model.
27
+ */
28
+ static fromSchematic(schematic: Schematic): BuildAnimation;
29
+
30
+ /**
31
+ * Apply one effect to every existing animation group.
32
+ */
33
+ animateAll(effect: AnimationEffect): void;
34
+
35
+ setDefaultEffect(effect: AnimationEffect): void;
36
+
37
+ /**
38
+ * Apply an effect to exactly the next recorded operation or explicit group.
39
+ * The returned borrowed builder enables fluent calls in every generated binding.
40
+ */
41
+ withEffect(effect: AnimationEffect): BuildAnimation;
42
+
43
+ setStepMs(stepMs: number): void;
44
+
45
+ setStaggerTotalMs(totalMs: number): void;
46
+
47
+ clearStagger(): void;
48
+
49
+ /**
50
+ * Shift every construction group's start time. Negative offsets let a
51
+ * repeating staggered effect cross the beginning of a loop capture.
52
+ */
53
+ setStaggerOffsetMs(offsetMs: number): void;
54
+
55
+ /**
56
+ * Capture exactly one loop period, excluding the duplicate endpoint.
57
+ * The rounded frame count evenly partitions the complete period.
58
+ */
59
+ setLoopPeriodMs(periodMs: number): void;
60
+
61
+ clearLoopPeriod(): void;
62
+
63
+ beginGroup(): void;
64
+
65
+ beginKeyedGroup(key: number): void;
66
+
67
+ endGroup(): number;
68
+
69
+ setBlock(x: number, y: number, z: number, block: string): number;
70
+
71
+ createRegion(name: string, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
72
+
73
+ setBlockInRegion(region: string, x: number, y: number, z: number, block: string): number;
74
+
75
+ translate(x: number, y: number, z: number, durationMs: number): void;
76
+
77
+ translateRegion(region: string, x: number, y: number, z: number, durationMs: number): void;
78
+
79
+ translateAll(x: number, y: number, z: number, durationMs: number): void;
80
+
81
+ rotateX(degrees: number, durationMs: number): void;
82
+
83
+ rotateY(degrees: number, durationMs: number): void;
84
+
85
+ rotateZ(degrees: number, durationMs: number): void;
86
+
87
+ rotateRegionX(region: string, degrees: number, durationMs: number): void;
88
+
89
+ rotateRegionY(region: string, degrees: number, durationMs: number): void;
90
+
91
+ rotateRegionZ(region: string, degrees: number, durationMs: number): void;
92
+
93
+ rotateAllX(degrees: number, durationMs: number): void;
94
+
95
+ rotateAllY(degrees: number, durationMs: number): void;
96
+
97
+ rotateAllZ(degrees: number, durationMs: number): void;
98
+
99
+ flipX(durationMs: number): void;
100
+
101
+ flipY(durationMs: number): void;
102
+
103
+ flipZ(durationMs: number): void;
104
+
105
+ flipRegionX(region: string, durationMs: number): void;
106
+
107
+ flipRegionY(region: string, durationMs: number): void;
108
+
109
+ flipRegionZ(region: string, durationMs: number): void;
110
+
111
+ flipAllX(durationMs: number): void;
112
+
113
+ flipAllY(durationMs: number): void;
114
+
115
+ flipAllZ(durationMs: number): void;
116
+
117
+ stampRegion(source: Schematic, region: string, x: number, y: number, z: number, exclusions: string, durationMs: number): void;
118
+
119
+ stampBox(source: Schematic, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number, x: number, y: number, z: number, exclusions: string, durationMs: number): void;
120
+
121
+ setOperationGizmos(enabled: boolean): void;
122
+
123
+ operationsJson(): string;
124
+
125
+ frameJson(timeMs: number): string;
126
+
127
+ /**
128
+ * Fill a parametric shape and record its voxels as ordered groups in
129
+ * the same transactional construction operation.
130
+ */
131
+ fillAlongParameter(shape: Shape, brush: Brush, groupCount: number): number;
132
+
133
+ addArmorStand(x: number, y: number, z: number, yaw: number, armorMaterial: string): number;
134
+
135
+ animateCamera(effect: AnimationEffect, offsetMs: number): void;
136
+
137
+ frameCount(fps: number, holdMs: number): number;
138
+
139
+ groupCount(): number;
140
+
141
+ durationMs(): number;
142
+ }
@@ -1,9 +1,9 @@
1
1
  // generated by diplomat-tool
2
- import type { AnimationEffect } from "./AnimationEffect"
3
- import type { Brush } from "./Brush"
4
- import type { NucleationError } from "./NucleationError"
5
- import type { Schematic } from "./Schematic"
6
- import type { Shape } from "./Shape"
2
+ import type { AnimationEffect } from "./AnimationEffect.mjs"
3
+ import type { Brush } from "./Brush.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Schematic } from "./Schematic.mjs"
6
+ import type { Shape } from "./Shape.mjs"
7
7
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
8
8
 
9
9