Package-level declarations

Types

Link copied to clipboard
class BytecodeModule(val manifest: JimManifest, val directory: Path, val runner: ByteCodeRunner) : JimModule

A module compiled to JVM bytecode by swc4j. Exported functions live on defaultClass as static methods; JIM looks them up (and caches a MethodHandle) when a trigger needs to call one.

Link copied to clipboard
object Callbacks
Link copied to clipboard
object Engines

The execution engine a module runs on (see JimManifest.engine).

Link copied to clipboard
class GraalCallback(fn: Value) : JimCallback

A raw GraalJS guest function. JavaScript tolerates arity mismatches (extra args ignored, missing ones become undefined), so every provided arg is passed through as-is. Must be called on the JS thread (the GraalJS org.graalvm.polyglot.Context is single-threaded) — which is where dispatch already runs.

Link copied to clipboard
class GraalModule(val manifest: JimManifest, val directory: Path) : JimModule

A module evaluated as an ES module by GraalJS. Its top-level code already ran on load (so top-level Jim.register(...) calls are live); namespace is the module's export namespace, from which named exported functions (for the main/init entry and trigger-name conventions) are read.

Link copied to clipboard

The GraalJS execution engine — the "real JavaScript" path. A JIM module's TypeScript is first transpiled to JavaScript by swc4j (here used as a plain TS→JS transpiler, not its bytecode compiler) and then evaluated as an ES module on a GraalJS Context. Scripts get full ECMAScript: real arrays with .map/.filter, closures over reassigned lets, objects, JSON, etc. — none of the bytecode path's "half-Java" workarounds (Store/Num/Args).

Link copied to clipboard
class HandleCallback(handle: MethodHandle, val paramCount: Int) : JimCallback

A JVM-side callable invoked through a MethodHandle, padded/truncated to paramCount.

Link copied to clipboard
sealed interface JimCallback

A script callback, normalized so the engine can invoke it the same way regardless of which engine produced it:

Link copied to clipboard

Compiles a JIM script (TypeScript / modern JS) straight to JVM bytecode using swc4j's ByteCodeCompiler. Scripts run as native JVM classes — every export function becomes a static method on the default $ class, and scripts reach the JIM API by importing our Kotlin objects by package, e.g. import { Jim, Event } from 'ratph6.jim.api'.

Link copied to clipboard
object JimEngine

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.

Link copied to clipboard
data class JimError(val where: String, val detail: String, val tick: Long, val stack: String? = null)

A captured script error, surfaced by /jim errors and the console. stack is the full chain.

Link copied to clipboard
object JimHooks

Static entry points that mixins (Java) call into. Kept dependency-light so the mixin classes don't need to know about Kotlin object instances.

Link copied to clipboard
object JimLoader

Discovers and compiles modules under <gameDir>/jim/modules/<moduleName>/.

Link copied to clipboard
data class JimLogLine(val level: String, val where: String, val message: String, val detail: String?, val tick: Long)

One line for the JIM console: a level (info/warn/error/debug), origin, message and optional detail.

Link copied to clipboard
data class JimManifest(val name: String, val version: String = "1.0.0", val author: String = "unknown", val description: String = "", val dependencies: List<String> = emptyList(), val priority: Int = 0, val entry: String = "index.ts", val engine: String = Engines.DEFAULT)

Parsed jim.json manifest.

Link copied to clipboard
sealed interface JimModule

A compiled, loaded module. Engine-agnostic surface: its manifest/dir, the names of its exported functions, and a uniform JimCallback for any one of them. Two implementations:

Link copied to clipboard

Bridge between the entity-render mixin and the engine. Called on the render thread (which is the JS thread), once before and once after each entity model is submitted, with the live PoseStack.

Link copied to clipboard
interface JimRenderTarget
Duck-typing interface mixed into EntityRenderState so JIM can recover the live Entity behind a render state.