Jim Engine
The heart of JIM. Compiles each module's TypeScript to JVM bytecode (via JimCompiler), invokes its main() entry point, and dispatches triggers by invoking the named exported function through a cached MethodHandle. No V8, no JNI on the dispatch path.
Minecraft-free on purpose, so the whole pipeline can be exercised from a plain JVM test.
Properties
Receives every console line (chat, Jim.log, errors). The console window registers here.
Invoked (on the JS/render thread) after modules load or reload, so the client can re-register script commands with brigadier (commands from post-startup loads are otherwise "unknown").
Callbacks run on reload/shutdown so MC-side state (e.g. HUD displays) can be cleared.
Class loader scripts compile against (so import { ChatLib } from 'ratph6.jim.api' resolves).
Functions
Dispatch from any thread (e.g. a mixin on the netty/packet thread): marshalled onto the JS thread, so it's observe-only (the originating call has already proceeded — no inline cancel). Cheaply skips work when no script listens for type, so high-volume sources (packets) are free until something registers.
Run a client command registered by a script (by name), passing the raw args array.
Run a one-off TypeScript snippet (used by /jim eval) on GraalJS, so it gets real ECMAScript (arrays, closures, let, JSON). The JIM API objects (Jim, Event, ChatLib, ...) are bound as globals by GraalRuntime, so no import line is needed.
A snapshot of recent console lines (for replay when the console opens).
Record a script error from a string detail (origin already known).
Record a script error from a Throwable, capturing the full cause chain and stack trace.