RustLib Mods
The flagship mod for RustLib: it demonstrates the entire chain — Fabric → JNI → Rust — without hiding anything. All decision-making logic (registries, events, quotas, and scheduling) is written in Rust; the Java code simply initializes the runtime and passes server ticks to it.
Current Capabilities
Startup: RustLib.start() loads the embedded native library and initializes the Rust runtime. If the native library is missing (e.g., on an unsupported platform), the mod gracefully disables itself instead of crashing the server.
Ticks: ServerTickEvents.END_SERVER_TICK triggers lib.tick(), which executes scheduled tasks within the allocated tick budget.
Rust-Defined Content: Includes two blocks (copper:copper_ore, copper:copper_lamp — light level 15) and two items (copper:raw_copper, copper:copper_pickaxe — durability 190), all exported as JSON by the runtime.
Events: A Rust-based event handler listens for BlockBreak events and cancels any attempt to mine copper:copper_ore once the limit of 64 breaks per 100-tick window has been exceeded. A recurring task resets the counter at the end of each window.
Current Limitations
To avoid any misunderstandings, here is what the mod does not support yet:
-
No Minecraft registration yet: Its blocks and items currently exist only within the Rust runtime and exported JSON. They are not yet registered in Minecraft itself. This is the next development milestone.
-
Windows x64 only: The included native library currently supports Windows x64 only. On Linux or macOS, the mod loads, logs "RustLib unavailable," and remains inactive.
-
No client-side features: No rendering, GUI, or key bindings.
Prerequisites
-
Minecraft 1.21.x (built and tested on 1.21.1).
-
Fabric Loader ≥ 0.16 and Fabric API.
-
Java 21.
-
RustLib is embedded in the JAR file, so no additional installation is required.
Why This Mod Exists
Because a library without a mod using it proves nothing.
RustLib Mods is the official reference implementation: it depends on dev.rustlib:rustlib, just as any other mod might depend on Fabric API. It serves as a starting point and template that developers can copy to implement their own logic in Rust.
License: MIT or Apache-2.0, at your choice.