RainJava
在 Minecraft 中编写 Java 代码。即时重载。无需重启。
RainJava 是一款强大的游戏内脚本模组,将完整的 Java 语言引入 Minecraft。在游戏运行时编写、编译和执行 Java 代码——修改行为、注入方法、转换字节码,并立即看到更改效果,无需重启游戏。
你能做什么
实时编码
创建在启动时、服务器启动时或客户端设置期间执行的 Java 脚本。在任何文本编辑器中编辑代码,保存文件,然后使用 /java reload 即时应用更改。内置的 Eclipse 编译器自动处理一切,即使你的系统未安装 Java 编译器也能正常工作。
Mixin 注入
直接以源码形式编写 Mixin 类,将代码注入任何 Minecraft 方法。使用 @Inject.At("HEAD") 定位方法开头,用 "RETURN" 捕获返回点,或用 "TAIL" 拦截最终出口。所有游戏类均可用于修改,并提供完整的 IDE 风格自动补全支持。
CoreMod & ASM 转换
对于深度修改,编写 CoreMod 插件,在 JVM 看到原始字节码之前对其进行转换。访问每个加载类的每条指令、字段和方法。这与传统 Forge coremod 拥有相同的功能级别,但通过简单的 Java 源文件即可实现,按需编译。
资产与数据包
将自定义纹理、模型、音效、配方、战利品表和标签直接打包到 RainJava 项目中。assets/ 和 data/ 文件夹的工作方式与标准资源包和数据包完全一致,随脚本自动加载。
工作原理
将 Java 源文件放置在 Minecraft 目录下的 RainJava/ 文件夹中。文件夹结构决定了代码的运行时机:
每个脚本都声明一个简单的 init() 方法。框架会自动发现、编译并执行这些脚本。错误会显示在专用的日志文件中,并通过 /java errors 命令在游戏中聊天栏显示。
必备文档
每次安装都会在 RainJava/ 文件夹中包含一份全面的 README.txt。该文件包含关于包声明、Mixin 语法、注入点、CoreMod 架构、可用命令以及故障排除的完整参考资料——全部可在离线状态下访问,无需互联网连接。
README 会随着每次发布更新,以反映当前的 API 行为和受支持的特性。遇到语法问题、错误消息或高级用法模式时,请首先查阅此文件。
命令
-
/java reload [startup|server|client] — 无需重启即可热重载脚本
-
/java hand getId — 显示手中物品的注册表 ID
-
/java hand getClass — 显示手中物品的 Java 类名
-
/java errors [type] — 在聊天栏中显示编译和运行时错误
要求
RainJava
Write Java Code Inside Minecraft. Reload Instantly. No Restarts.
RainJava is a powerful in-game scripting mod that brings the full Java language into Minecraft. Write, compile, and execute Java code while the game is running — modify behavior, inject methods, transform bytecode, and see changes immediately without restarting.
What You Can Do
Live Coding
Create Java scripts that execute at startup, when the server starts, or during client setup. Edit code in any text editor, save the file, and use /java reload to apply changes instantly. The built-in Eclipse compiler handles everything automatically, even if your system has no Java compiler installed.
Mixin Injection
Write Mixin classes directly in source form to inject code into any Minecraft method. Target the beginning of a method with @Inject.At("HEAD"), catch return points with "RETURN", or intercept the final exit with "TAIL". All game classes are available for modification with full IDE-style autocomplete support.
CoreMod & ASM Transformation
For deep modifications, write CoreMod plugins that transform raw bytecode before the JVM sees it. Access every instruction, field, and method of any loaded class. This is the same power level as traditional Forge coremods, but accessible through simple Java source files that compile on demand.
Asset & Data Packs
Bundle custom textures, models, sounds, recipes, loot tables, and tags directly in your RainJava project. The assets/ and data/ folders work exactly like standard resource and data packs, loaded automatically with your scripts.
How It Works
Place Java source files in the RainJava/ folder inside your Minecraft directory. The folder structure determines when code runs:
-
startup/ — Executes once when the game initializes
-
server/ — Executes each time the server starts
-
client/ — Executes during client setup
-
mixins/ — Mixin classes for runtime method injection
-
coremod/ — CoreMod plugins and ASM transformers
Every script declares a simple init() method. The framework discovers, compiles, and executes automatically. Errors appear in dedicated log files and in-game chat via the /java errors command.
Essential Documentation
Every installation includes a comprehensive README.txt in the RainJava/ folder. This file contains complete reference material for package declarations, Mixin syntax, injection points, CoreMod architecture, available commands, and troubleshooting — all available offline without internet access.
The README is updated with each release to reflect current API behavior and supported features. Consult it first for syntax questions, error messages, or advanced usage patterns.
Commands
-
/java reload [startup|server|client] — Hot-reload scripts without restart
-
/java hand getId — Display held item registry ID
-
/java hand getClass — Display held item Java class name
-
/java errors [type] — Show compilation and runtime errors in chat
Requirements
评论 0
登录后参与评分
还没有评论,来抢沙发吧