English
Introduction
OhMyLoader (OML) is a mod loader for Minecraft Java Edition. It provides a custom bytecode injection engine, a two-layer mod API, and declarative content registration on the client and the dedicated server. The loader currently targets 26.4 snapshots; the full stack runs on Java 27.
Design
Unified semantic API
Mods use high-level game semantics (events, lifecycle, content registration) and do not touch version internals. The per-version adapter absorbs version differences below that layer; they do not leak upward.
Injection engine
The loader implements its own injection engine and replaces the SpongePowered Mixin and Access Transformer layers:
- Injection DSL: anchors such as
atHead,atReturn, andbeforeCall, with payloads such ascall,modifyArg, andredirectCall. The semantics match Mixin, but the rules are declarative and self-checked at startup. - Member merging:
@Borrowed,@Replace,@Extra,@FieldAccess, and@MethodAccessare supported, via the explicit@Mergedcarrier. - Annotation front end: hook carriers (
@Hooked/@Merged) declare@Injectand friends; the loader compiles the annotations into injection rules and runs them through the same pipeline.
Every rule is self-checked at startup for handler existence, staticness, signature consistency, and anchor/access-rule sanity. Target existence and match counts are enforced when the target class loads, and the bundled adapter's anchors are checked against the real game jar at build time. A wrong rule fails fast instead of silently doing less in game.
Thin adapter
The adapter module (oml-adapter) maps hook anchors and native types for the newest game line and is shape-checked against the real game jar at build time. Snapshot tracking resolves the latest snapshot at runtime (minecraftVersion.set("snapshot")); a new game version needs a shape check and mapping, not a rewrite.
Two content tracks
- Code track: declare blocks, items, and recipes with
ContentRegistry; they materialize into native content at the registry freeze point. - Data track: declare data-driven blocks and items as per-entity TOML files under
content/in an.omlarchive, with no code.
Repositories
| Repository | Contents |
|---|---|
| OhMyLoader | Loader: core, API, adapter, installer, native library |
| OhMyLoaderGradle | Official Gradle plugin: runtime assembly and runClient / runServer |
| OhMyLoaderTestMod | End-to-end verification mod, consumed exactly like an external mod project |
The three repositories consume each other only by Maven coordinate. The rest of the organization — shared CI (Foundation), the standalone diagnostics toolbox, and the example mod ports — lives at github.com/OhMyLoader.
API stability
The mod-facing surface has three tiers, defined in the loader's oml-api-core/README.md:
- Contracted: the
@Modentry,OMLModInitializer/ModContext,Events, the content declaration DSL, and the injection DSL. During 0.x, breaking changes land directly as!commits with no deprecation window; each commit body gives the migration. From 1.0, the tier freezes: breaking changes become major-version events, and old signatures remain deprecated for one major release. - Provided, settling: commands, config, network, keybindings/HUD/creative tabs, and the main-thread scheduler. These may change until 1.0; changes are recorded in the release notes.
- Version-facing, tracks the game: the
oml-apiartifact. Event payloads and extensions name the game's own classes (ServerPlayer,BlockPos,DamageSource). There is no wrapper layer; a game type is the game type. This tier is contracted to one game version; a new game version rebuilds the sameoml-apiagainst it. A few handles (OMLCommandSource,OMLNetworkContext,OMLBlock) keep aplatformproperty for reaching the raw game object.