nucleation 0.6.0 → 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
package/IoLayout.d.mts ADDED
@@ -0,0 +1,26 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * An immutable IO layout. Wraps
8
+ * {@link crate::simulation::typed_executor::IoLayout}.
9
+ */
10
+ export class IoLayout {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * Input names as a JSON array string.
19
+ */
20
+ inputNamesJson(): string;
21
+
22
+ /**
23
+ * Output names as a JSON array string.
24
+ */
25
+ outputNamesJson(): string;
26
+ }
@@ -0,0 +1,73 @@
1
+ // generated by diplomat-tool
2
+ import type { IoLayout } from "./IoLayout.mjs"
3
+ import type { IoType } from "./IoType.mjs"
4
+ import type { LayoutFunction } from "./LayoutFunction.mjs"
5
+ import type { NucleationError } from "./NucleationError.mjs"
6
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
7
+
8
+
9
+
10
+ /**
11
+ * Builder for an {@link IoLayout}. `build` consumes it (PORTING rule 11).
12
+ */
13
+ export class IoLayoutBuilder {
14
+ /** @internal */
15
+ get ffiValue(): pointer;
16
+ /** @internal */
17
+ constructor();
18
+
19
+
20
+ /**
21
+ * Create an empty layout builder.
22
+ */
23
+ static create(): IoLayoutBuilder;
24
+
25
+ /**
26
+ * Add an input. `positions` is flat `[x,y,z, x,y,z, ...]`.
27
+ */
28
+ addInput(name: string, ioType: IoType, layout: LayoutFunction, positions: Array<number>): void;
29
+
30
+ /**
31
+ * Add an output. `positions` is flat `[x,y,z, x,y,z, ...]`.
32
+ */
33
+ addOutput(name: string, ioType: IoType, layout: LayoutFunction, positions: Array<number>): void;
34
+
35
+ /**
36
+ * Add an input with automatic layout inference.
37
+ */
38
+ addInputAuto(name: string, ioType: IoType, positions: Array<number>): void;
39
+
40
+ /**
41
+ * Add an output with automatic layout inference.
42
+ */
43
+ addOutputAuto(name: string, ioType: IoType, positions: Array<number>): void;
44
+
45
+ /**
46
+ * Add an input from a region given as flat block positions (sorted by
47
+ * the default YXZ strategy, matching the old region semantics).
48
+ */
49
+ addInputFromRegion(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
50
+
51
+ /**
52
+ * Add an input from a region (flat positions) with automatic layout
53
+ * inference.
54
+ */
55
+ addInputFromRegionAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
56
+
57
+ /**
58
+ * Add an output from a region given as flat block positions.
59
+ */
60
+ addOutputFromRegion(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
61
+
62
+ /**
63
+ * Add an output from a region (flat positions) with automatic layout
64
+ * inference.
65
+ */
66
+ addOutputFromRegionAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
67
+
68
+ /**
69
+ * Build the {@link IoLayout}. Consumes the builder (a second call returns
70
+ * `AlreadyConsumed`).
71
+ */
72
+ build(): IoLayout;
73
+ }
@@ -1,8 +1,8 @@
1
1
  // generated by diplomat-tool
2
- import type { IoLayout } from "./IoLayout"
3
- import type { IoType } from "./IoType"
4
- import type { LayoutFunction } from "./LayoutFunction"
5
- import type { NucleationError } from "./NucleationError"
2
+ import type { IoLayout } from "./IoLayout.mjs"
3
+ import type { IoType } from "./IoType.mjs"
4
+ import type { LayoutFunction } from "./LayoutFunction.mjs"
5
+ import type { NucleationError } from "./NucleationError.mjs"
6
6
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
7
7
 
8
8
 
package/IoType.d.mts ADDED
@@ -0,0 +1,41 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * The wire type of a circuit input/output (PORTING rule 10).
8
+ */
9
+ export class IoType {
10
+ /** @internal */
11
+ get ffiValue(): pointer;
12
+ /** @internal */
13
+ constructor();
14
+
15
+
16
+ /**
17
+ * Unsigned integer of `bits` bits (LSB-first bit order).
18
+ */
19
+ static unsignedInt(bits: number): IoType;
20
+
21
+ /**
22
+ * Signed integer of `bits` bits (two's complement, LSB-first).
23
+ */
24
+ static signedInt(bits: number): IoType;
25
+
26
+ /**
27
+ * 32-bit IEEE 754 float (crosses the wire as its 32 raw bits).
28
+ */
29
+ static float32(): IoType;
30
+
31
+ /**
32
+ * Single boolean (1 bit).
33
+ */
34
+ static boolean(): IoType;
35
+
36
+ /**
37
+ * Fixed-length ASCII string of `chars` characters (8 bits per char;
38
+ * shorter strings are zero-padded, longer ones truncated).
39
+ */
40
+ static ascii(chars: number): IoType;
41
+ }
@@ -0,0 +1,65 @@
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
+ * Item model generation configuration. Wraps {@link crate::meshing::ItemModelConfig}.
9
+ */
10
+ export class ItemModelConfig {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * Create a config for a model named `model_name` (used in resource-pack
19
+ * file paths). Other options start at their defaults: namespace
20
+ * "nucleation", centered, 16px texture resolution, item "paper",
21
+ * custom model data "1", auto scale.
22
+ */
23
+ static create(modelName: string): ItemModelConfig;
24
+
25
+ /**
26
+ * Set the resource-pack namespace (default: "nucleation").
27
+ */
28
+ setNamespace(namespace: string): void;
29
+
30
+ /**
31
+ * Center the schematic within the model bounds (default: true).
32
+ */
33
+ setCenter(center: boolean): void;
34
+
35
+ /**
36
+ * Set the texture resolution in pixels per block face (default: 16).
37
+ */
38
+ setTextureResolution(resolution: number): void;
39
+
40
+ /**
41
+ * Set the Minecraft item the model binds to (default: "paper").
42
+ */
43
+ setItem(item: string): void;
44
+
45
+ /**
46
+ * Set the custom-model-data string used to select this model in game
47
+ * (default: "1").
48
+ */
49
+ setCustomModelData(cmd: string): void;
50
+
51
+ /**
52
+ * Uniform scale.
53
+ */
54
+ setScale(scale: number): void;
55
+
56
+ /**
57
+ * Per-axis scale.
58
+ */
59
+ setScaleXyz(sx: number, sy: number, sz: number): void;
60
+
61
+ /**
62
+ * Auto-fit scale.
63
+ */
64
+ setScaleAuto(): void;
65
+ }
@@ -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,32 @@
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
+ * Accumulates {@link ItemModelResult}s to build a combined resource pack ZIP
9
+ * (old ABI: `itemmodel_build_resource_pack` took an array of pointers).
10
+ */
11
+ export class ItemModelPackBuilder {
12
+ /** @internal */
13
+ get ffiValue(): pointer;
14
+ /** @internal */
15
+ constructor();
16
+
17
+
18
+ /**
19
+ * Create an empty pack builder.
20
+ */
21
+ static create(): ItemModelPackBuilder;
22
+
23
+ /**
24
+ * Number of results added so far.
25
+ */
26
+ len(): number;
27
+
28
+ /**
29
+ * Build a resource pack ZIP from every added result, base64-encoded.
30
+ */
31
+ buildZipB64(): string;
32
+ }
@@ -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,72 @@
1
+ // generated by diplomat-tool
2
+ import type { Dimensions } from "./Dimensions.mjs"
3
+ import type { ItemModelConfig } from "./ItemModelConfig.mjs"
4
+ import type { ItemModelPackBuilder } from "./ItemModelPackBuilder.mjs"
5
+ import type { ItemScale } from "./ItemScale.mjs"
6
+ import type { NucleationError } from "./NucleationError.mjs"
7
+ import type { ResourcePack } from "./ResourcePack.mjs"
8
+ import type { Schematic } from "./Schematic.mjs"
9
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
10
+
11
+
12
+
13
+ /**
14
+ * A generated item model. Wraps {@link crate::meshing::ItemModelResult}.
15
+ *
16
+ * Holds `Option<...>` because {@link ItemModelResult::add_to_pack} moves the
17
+ * inner value into an {@link ItemModelPackBuilder} (PORTING rule 11); accessors
18
+ * return `AlreadyConsumed` afterwards.
19
+ */
20
+ export class ItemModelResult {
21
+ /** @internal */
22
+ get ffiValue(): pointer;
23
+ /** @internal */
24
+ constructor();
25
+
26
+
27
+ /**
28
+ * Generate an item model from a schematic (old ABI: `schematic_to_item_model`).
29
+ */
30
+ static create(schematic: Schematic, pack: ResourcePack, config: ItemModelConfig): ItemModelResult;
31
+
32
+ /**
33
+ * The Minecraft item model JSON.
34
+ */
35
+ modelJson(): string;
36
+
37
+ /**
38
+ * Number of elements (cuboids) in the generated model.
39
+ */
40
+ elementCount(): number;
41
+
42
+ /**
43
+ * Number of textures the generated model uses.
44
+ */
45
+ textureCount(): number;
46
+
47
+ /**
48
+ * Number of textured planes in the generated model.
49
+ */
50
+ planeCount(): number;
51
+
52
+ /**
53
+ * Source schematic dimensions in blocks.
54
+ */
55
+ dimensions(): Dimensions;
56
+
57
+ /**
58
+ * The applied model scale (old ABI: `itemmodel_result_scale`).
59
+ */
60
+ scale(): ItemScale;
61
+
62
+ /**
63
+ * A single-model resource pack ZIP, base64-encoded.
64
+ */
65
+ toResourcePackZipB64(): string;
66
+
67
+ /**
68
+ * Move this result into a pack builder. Consumes the result: further
69
+ * accessor calls return `AlreadyConsumed`.
70
+ */
71
+ addToPack(builder: ItemModelPackBuilder): void;
72
+ }
@@ -1,11 +1,11 @@
1
1
  // generated by diplomat-tool
2
- import type { Dimensions } from "./Dimensions"
3
- import type { ItemModelConfig } from "./ItemModelConfig"
4
- import type { ItemModelPackBuilder } from "./ItemModelPackBuilder"
5
- import type { ItemScale } from "./ItemScale"
6
- import type { NucleationError } from "./NucleationError"
7
- import type { ResourcePack } from "./ResourcePack"
8
- import type { Schematic } from "./Schematic"
2
+ import type { Dimensions } from "./Dimensions.mjs"
3
+ import type { ItemModelConfig } from "./ItemModelConfig.mjs"
4
+ import type { ItemModelPackBuilder } from "./ItemModelPackBuilder.mjs"
5
+ import type { ItemScale } from "./ItemScale.mjs"
6
+ import type { NucleationError } from "./NucleationError.mjs"
7
+ import type { ResourcePack } from "./ResourcePack.mjs"
8
+ import type { Schematic } from "./Schematic.mjs"
9
9
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
10
10
 
11
11
 
@@ -0,0 +1,31 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type ItemScale_obj = {
5
+ x: number;
6
+ y: number;
7
+ z: number;
8
+ };
9
+
10
+
11
+
12
+ /**
13
+ * Non-uniform model scale factors.
14
+ */
15
+ export class ItemScale {
16
+ get x(): number;
17
+ set x(value: number);
18
+ get y(): number;
19
+ set y(value: number);
20
+ get z(): number;
21
+ set z(value: number);
22
+ /** @internal */
23
+ static fromFields(structObj : ItemScale_obj) : ItemScale;
24
+
25
+ /**
26
+ * Create `ItemScale` from an object that contains all of `ItemScale`s fields.
27
+ * Optional fields do not need to be included in the provided object.
28
+ */
29
+ constructor(structObj: ItemScale_obj);
30
+
31
+ }
@@ -0,0 +1,52 @@
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
+ * Maps logical bits to physical positions (PORTING rule 10).
9
+ */
10
+ export class LayoutFunction {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * One bit per position: signal strength 0 = false, 15 = true.
19
+ * The most common layout for traditional redstone circuits.
20
+ */
21
+ static oneToOne(): LayoutFunction;
22
+
23
+ /**
24
+ * Four bits per position, packed as a hex nibble (0-15) with the
25
+ * lowest bit first; uses `ceil(bits / 4)` positions (4x denser than
26
+ * one-to-one).
27
+ */
28
+ static packed4(): LayoutFunction;
29
+
30
+ /**
31
+ * Custom bit-to-position mapping.
32
+ */
33
+ static custom(mapping: Array<number>): LayoutFunction;
34
+
35
+ /**
36
+ * 2D matrix layout, elements laid out row by row; element bits are
37
+ * packed 4 per position (nibbles).
38
+ */
39
+ static rowMajor(rows: number, cols: number, bitsPerElement: number): LayoutFunction;
40
+
41
+ /**
42
+ * 2D matrix layout, elements laid out column by column; element bits
43
+ * are packed 4 per position (nibbles).
44
+ */
45
+ static columnMajor(rows: number, cols: number, bitsPerElement: number): LayoutFunction;
46
+
47
+ /**
48
+ * Screen layout: pixels laid out row by row, left to right; pixel
49
+ * bits are packed 4 per position (nibbles).
50
+ */
51
+ static scanline(width: number, height: number, bitsPerPixel: number): LayoutFunction;
52
+ }
@@ -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,131 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { RedstoneGraph } from "./RedstoneGraph.mjs"
4
+ import type { Schematic } from "./Schematic.mjs"
5
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
6
+
7
+
8
+
9
+ /**
10
+ * A running MCHPRS redstone simulation. Wraps {@link crate::simulation::MchprsWorld}.
11
+ */
12
+ export class MchprsWorld {
13
+ /** @internal */
14
+ get ffiValue(): pointer;
15
+ /** @internal */
16
+ constructor();
17
+
18
+
19
+ /**
20
+ * Create a simulation world from a schematic with default options.
21
+ */
22
+ static create(schematic: Schematic): MchprsWorld;
23
+
24
+ /**
25
+ * Create a simulation world with explicit options.
26
+ */
27
+ static createWithOptions(schematic: Schematic, optimize: boolean, ioOnly: boolean): MchprsWorld;
28
+
29
+ /**
30
+ * Create a simulation world with custom IO positions
31
+ * (`custom_io_positions` is flat `[x,y,z, x,y,z, ...]`).
32
+ */
33
+ static createWithCustomIo(schematic: Schematic, optimize: boolean, ioOnly: boolean, customIoPositions: Array<number>): MchprsWorld;
34
+
35
+ /**
36
+ * One-shot convenience (old ABI: `schematic_simulate_use_block`):
37
+ * build a world from `schematic`, fire an `on_use_block` event per
38
+ * triple in `events_xyz`, run `ticks` ticks, and return the simulated
39
+ * schematic. Unlike the old ABI (which mutated in place), this returns
40
+ * a new `Schematic`.
41
+ */
42
+ static simulateUseBlock(schematic: Schematic, ticks: number, eventsXyz: Array<number>): Schematic;
43
+
44
+ /**
45
+ * Advance the simulation by `ticks` ticks.
46
+ */
47
+ tick(ticks: number): void;
48
+
49
+ /**
50
+ * Flush pending changes from the compiler to the world.
51
+ */
52
+ flush(): void;
53
+
54
+ /**
55
+ * Set the power state of a lever.
56
+ */
57
+ setLeverPower(x: number, y: number, z: number, powered: boolean): void;
58
+
59
+ /**
60
+ * Get the power state of a lever.
61
+ */
62
+ getLeverPower(x: number, y: number, z: number): boolean;
63
+
64
+ /**
65
+ * Whether a redstone lamp is lit at the given position.
66
+ */
67
+ isLit(x: number, y: number, z: number): boolean;
68
+
69
+ /**
70
+ * Set the signal strength (0-15) at a custom IO position.
71
+ */
72
+ setSignalStrength(x: number, y: number, z: number, strength: number): void;
73
+
74
+ /**
75
+ * Get the signal strength (0-15) at a position.
76
+ */
77
+ getSignalStrength(x: number, y: number, z: number): number;
78
+
79
+ /**
80
+ * Simulate a right-click on a block (typically a lever).
81
+ */
82
+ onUseBlock(x: number, y: number, z: number): void;
83
+
84
+ /**
85
+ * Sync the simulation state back to the internal schematic.
86
+ */
87
+ syncToSchematic(): void;
88
+
89
+ /**
90
+ * A clone of the world's schematic.
91
+ */
92
+ getSchematic(): Schematic;
93
+
94
+ /**
95
+ * The redstone power level (0-15) at a position.
96
+ */
97
+ getRedstonePower(x: number, y: number, z: number): number;
98
+
99
+ /**
100
+ * Check for custom IO changes since the last check. Call before
101
+ * `poll_custom_io_changes_json`.
102
+ */
103
+ checkCustomIoChanges(): void;
104
+
105
+ /**
106
+ * Queued custom IO changes as a JSON array
107
+ * (`[{"x":..,"y":..,"z":..,"old_power":..,"new_power":..}, ...]`),
108
+ * clearing the queue.
109
+ */
110
+ pollCustomIoChangesJson(): string;
111
+
112
+ /**
113
+ * Queued custom IO changes as JSON without clearing the queue.
114
+ */
115
+ peekCustomIoChangesJson(): string;
116
+
117
+ /**
118
+ * Clear all queued custom IO changes.
119
+ */
120
+ clearCustomIoChanges(): void;
121
+
122
+ /**
123
+ * Extract the compiled (post-optimization) redstone logic graph.
124
+ */
125
+ exportGraph(): RedstoneGraph;
126
+
127
+ /**
128
+ * Extract the structural (pre-fold, as-built) redstone logic graph.
129
+ */
130
+ exportGraphStructural(): RedstoneGraph;
131
+ }
package/MchprsWorld.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
3
- import type { RedstoneGraph } from "./RedstoneGraph"
4
- import type { Schematic } from "./Schematic"
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { RedstoneGraph } from "./RedstoneGraph.mjs"
4
+ import type { Schematic } from "./Schematic.mjs"
5
5
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
6
6
 
7
7
 
@@ -0,0 +1,40 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type MeshBounds_obj = {
5
+ minX: number;
6
+ minY: number;
7
+ minZ: number;
8
+ maxX: number;
9
+ maxY: number;
10
+ maxZ: number;
11
+ };
12
+
13
+
14
+
15
+ /**
16
+ * Axis-aligned bounding box of a mesh result.
17
+ */
18
+ export class MeshBounds {
19
+ get minX(): number;
20
+ set minX(value: number);
21
+ get minY(): number;
22
+ set minY(value: number);
23
+ get minZ(): number;
24
+ set minZ(value: number);
25
+ get maxX(): number;
26
+ set maxX(value: number);
27
+ get maxY(): number;
28
+ set maxY(value: number);
29
+ get maxZ(): number;
30
+ set maxZ(value: number);
31
+ /** @internal */
32
+ static fromFields(structObj : MeshBounds_obj) : MeshBounds;
33
+
34
+ /**
35
+ * Create `MeshBounds` from an object that contains all of `MeshBounds`s fields.
36
+ * Optional fields do not need to be included in the provided object.
37
+ */
38
+ constructor(structObj: MeshBounds_obj);
39
+
40
+ }