Oxidizium - 将 Ferris 注入你的服务器!?
简介
此 Fabric 模组使用原生 Rust 代码替换了部分 Minecraft Java Edition 的方法。
每个 Rust 函数均通过内部测试工具进行了测试,以确保其与原版 Minecraft 在功能上完全一致。
本模组主要设计用于服务端,但也可在客户端使用(存在少量渲染瑕疵)。
目前,该模组使用 Rust 重写了以下 Java 类:
未来计划重写更多类,但在初期阶段将主要处理底层类。
兼容性
截至目前,Oxidizium 与大多数模组具有极高的兼容性,并特别针对 Lithium 进行了适配。
欢迎提交 PR 添加您自己的原生 Rust 代码!
后端
Oxidizium 默认提供三种后端:Panama、Nalim 和 Membrane。后端类型会显示在 jar 包文件名和模组名称中。
每种后端略有不同,详情请见下文:
Project Panama
Project Panama 是 Java 22+ 的一项特性,允许低延迟的原生代码执行。它适用于从 1.14.3 到最新版本 Minecraft 的所有版本。
使用方法
必须安装 Java 22 或更高版本才能使用 Project Panama!
推荐以下 JVM 参数,但对于 Java 25 及以下版本,这些参数当前并非必需:
--enable-preview --enable-native-access=ALL-UNNAMED
使用更新的 Java 版本可能会带来比 Java 22 更好的性能提升。推荐使用 GraalVM 以获得最佳性能,但请注意,GraalVM 有可能(尽管可能性极低)导致模组崩溃。如果希望完全确保安全,请使用如 Temurin 这样的发行版。
Nalim
Nalim 是一个第三方库,能够在执行原生代码时实现接近原生的低延迟。对于叶子节点(快速)调用,其速度约为 Project Panama 的 3 倍;根据 Nalim README 的数据,在 JDK 19 上,其速度相比早期的 FFM Panama 快了约 50 倍。
Nalim 历史上在 Java 21+ 版本会出现问题,因为 Loom JEP 444 使得 JVMCI nmethod 入口屏障成为所有 GC 的强制要求。
Oxidizium 附带了一个由 FurryMileon 修补的 Nalim jar,它在尾调用后生成一个“空操作”屏障序列,从而使 JVMCI 验证通过且无运行时开销——这些屏障字节实际上是死代码(放置在 jmp rax / br x9 之后)。
使用方法
运行 Nalim 必须使用以下 JVM 参数:-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
Membrane
Membrane 的工作原理类似于 Nalim,但效果可能不如 Nalim(基准测试即将发布)。这是一个实验性后端,不建议在生产环境中使用。
与 Nalim 类似,它过去需要 Java 20 及更低版本,但得益于随附的由 QPCrummer 修补的 Membrane jar,它现在可以在使用 Java 21 和 25 的所有 Minecraft 版本中完美运行!
使用方法
运行 Membrane 必须使用以下 JVM 参数:-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
推荐但不强制使用以下 JVM 参数:-XX:+EnableDynamicAgentLoading
Oxidizium - Inject Ferris into your server! ?
Summary
This Fabric mod replaces certain Minecraft Java Edition methods with native rust equivalents.
Every rust function is tested with the in-house testing utility to ensure that it is functionally equal to vanilla Minecraft.
This mod is intended to be used server-side, but can be used on the client (with minor rendering bugs).
Currently, this mod replaces the following Java classes with Rust:
Many more classes are planned in the future, however mostly low-level classes will be tackled in the beginning.
Compatibility
As of now, Oxidizium is very compatible with the majority of mods, with specific compatibility with Lithium.
Feel free to PR any of your own Rust native code!
Backends
Oxidizium comes with 3 backends by default: Panama, Nalim, and Membrane. The backend will be in the jar and mod name.
Each backend is slightly different, so read about them below:
Project Panama
Project Panama is a Java 22+ feature that allows for low latency native code execution. This works on any Minecraft version
from 1.14.3 to modern MC.
Usage
You must install Java 22 or above to use Project Panama!
The following JVM arguments are recommended, but not currently required for Java 25 and below:
--enable-preview --enable-native-access=ALL-UNNAMED
Using a newer Java version is likely to improve performance more than Java 22. I recommend using GraalVM for the
best performance, however be warned that it is possible (though very unlikely) that GraalVM could break mods. Use a
distribution such as Temurin if you want to be completely safe.
Nalim
Nalim is a 3rd-party library that enables near-native latency when executing native code. It is roughly 3x faster than
Project Panama for leaf (quick) calls and was ~50x faster vs pre-FFM Panama on JDK 19, per the Nalim README.
Nalim historically broke on Java 21+ because Loom JEP 444 made the JVMCI nmethod entry barrier mandatory for every GC.
Oxidizium ships a Nalim jar patched by FurryMileon that emits a "no-op" barrier sequence after the tail-call so JVMCI validation passes
without any runtime overhead — the barrier bytes are dead code (placed after jmp rax / br x9).
Usage
The following JVM arguments are required to run Nalim: -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
Membrane
Membrane works similar to Nalim, though may not be as affective as Nalim (benchmarks soon). It is an experimental backend and is not recommended to be used in production.
Like Nalim, it used to require Java 20 and below, but thanks to an included patched Membrane jar by QPCrummer,
it works great in all Minecraft versions using Java 21 and 25!
Usage
The following JVM arguments are required to run Membrane: -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
The following JVM argument is recommended, but not required yet: -XX:+EnableDynamicAgentLoading
评论 0
登录后参与评分
还没有评论,来抢沙发吧