// generated by diplomat-tool import type { NucleationError } from "./NucleationError.mjs" import type { RedstoneGraph } from "./RedstoneGraph.mjs" import type { Schematic } from "./Schematic.mjs" import type { pointer, codepoint } from "./diplomat-runtime.d.ts"; /** * A running MCHPRS redstone simulation. Wraps {@link crate::simulation::MchprsWorld}. */ export class MchprsWorld { /** @internal */ get ffiValue(): pointer; /** @internal */ constructor(); /** * Create a simulation world from a schematic with default options. */ static create(schematic: Schematic): MchprsWorld; /** * Create a simulation world with explicit options. */ static createWithOptions(schematic: Schematic, optimize: boolean, ioOnly: boolean): MchprsWorld; /** * Create a simulation world with custom IO positions * (`custom_io_positions` is flat `[x,y,z, x,y,z, ...]`). */ static createWithCustomIo(schematic: Schematic, optimize: boolean, ioOnly: boolean, customIoPositions: Array): MchprsWorld; /** * One-shot convenience (old ABI: `schematic_simulate_use_block`): * build a world from `schematic`, fire an `on_use_block` event per * triple in `events_xyz`, run `ticks` ticks, and return the simulated * schematic. Unlike the old ABI (which mutated in place), this returns * a new `Schematic`. */ static simulateUseBlock(schematic: Schematic, ticks: number, eventsXyz: Array): Schematic; /** * Advance the simulation by `ticks` ticks. */ tick(ticks: number): void; /** * Flush pending changes from the compiler to the world. */ flush(): void; /** * Set the power state of a lever. */ setLeverPower(x: number, y: number, z: number, powered: boolean): void; /** * Get the power state of a lever. */ getLeverPower(x: number, y: number, z: number): boolean; /** * Whether a redstone lamp is lit at the given position. */ isLit(x: number, y: number, z: number): boolean; /** * Set the signal strength (0-15) at a custom IO position. */ setSignalStrength(x: number, y: number, z: number, strength: number): void; /** * Get the signal strength (0-15) at a position. */ getSignalStrength(x: number, y: number, z: number): number; /** * Simulate a right-click on a block (typically a lever). */ onUseBlock(x: number, y: number, z: number): void; /** * Sync the simulation state back to the internal schematic. */ syncToSchematic(): void; /** * A clone of the world's schematic. */ getSchematic(): Schematic; /** * The redstone power level (0-15) at a position. */ getRedstonePower(x: number, y: number, z: number): number; /** * Check for custom IO changes since the last check. Call before * `poll_custom_io_changes_json`. */ checkCustomIoChanges(): void; /** * Queued custom IO changes as a JSON array * (`[{"x":..,"y":..,"z":..,"old_power":..,"new_power":..}, ...]`), * clearing the queue. */ pollCustomIoChangesJson(): string; /** * Queued custom IO changes as JSON without clearing the queue. */ peekCustomIoChangesJson(): string; /** * Clear all queued custom IO changes. */ clearCustomIoChanges(): void; /** * Extract the compiled (post-optimization) redstone logic graph. */ exportGraph(): RedstoneGraph; /** * Extract the structural (pre-fold, as-built) redstone logic graph. */ exportGraphStructural(): RedstoneGraph; }