Graphene
Graphene 是一个面向 Minecraft 的客户端 UI 库,允许模组开发者使用 Web 技术构建界面。
它通过 JCEF 嵌入 Chromium,因此你可以在游戏中渲染 HTML/CSS/JavaScript 界面,同时保持干净的 Java API 以方便模组集成。

什么是 Graphene?
Graphene 桥接了 Minecraft 模组开发与现代 Web UI 开发。你无需使用 Minecraft 的渲染基元来构建每一个屏幕,而是可以使用 HTML、CSS 和 JavaScript 创建界面,然后通过 Java API 将它们与你的模组集成。
Graphene 提供:
- 可嵌入 Minecraft 屏幕的交互式 Chromium 视图;
- 打包的资源 URL 和可选的开发 HTTP 服务器;
- 通过异步桥接实现的 Java/JavaScript 双向通信;
- 浏览器导航、输入、下载、对话框、上下文菜单和生命周期控制;
- 用于自定义渲染集成的离屏浏览器会话和表面;
- Chromium DevTools 支持,用于检查和调试页面。
查看 兼容性和安装 以获取支持的 Minecraft 和加载器版本信息。
要求
- Java:
25 对应 Minecraft 26.2 和 26.1.2,21 对应 Minecraft 1.21.11
- GPU:
NVIDIA GeForce GT 720 或更高
- macOS 用户:macOS 12 (Monterey) 或更高版本
支持的平台
- macOS:
arm64, amd64
- Linux:
arm64, amd64
- Windows:
amd64, arm64
已测试平台
- Windows 11,使用
AZERTY 和 QWERTY 键盘布局
- Linux (Wayland),使用
AZERTY 和 QWERTY 键盘布局
- macOS 26,使用
QWERTY 键盘布局
安装
Graphene 已发布到 Maven Central。在 GitHub Releases、Modrinth 或特定于 Minecraft 版本的 Maven Central 制品中查找最新版本,然后将与你目标 Minecraft 版本匹配的制品添加为模组依赖项:
repositories {
mavenCentral()
}
dependencies {
modImplementation("io.github.trethore:graphene-ui-26.2:<version>")
// 或者对于 Minecraft 26.1.2:
// modImplementation("io.github.trethore:graphene-ui-26.1.2:<version>")
// 或者对于 Minecraft 1.21.11:
// modImplementation("io.github.trethore:graphene-ui-1.21.11:<version>")
}
在 fabric.mod.json 中将 Graphene 声明为运行时依赖项:
{
"depends": {
"grapheneui": ">=<version>"
}
}
从模组的客户端初始化程序注册它并保留返回的上下文:
import io.github.trethore.graphene.api.Graphene;
import io.github.trethore.graphene.api.GrapheneContext;
import net.fabricmc.api.ClientModInitializer;
public final class ExampleModClient implements ClientModInitializer {
private static GrapheneContext graphene;
@Override
public void onInitializeClient() {
graphene = Graphene.register(ExampleModClient.class);
}
public static GrapheneContext graphene() {
return graphene;
}
}
请参阅以下文档页面以获取更多详细信息:
贡献
欢迎贡献!
文档
请从这里开始 HERE!
许可证
由 Titouan Réthoré 根据 MIT License 授权。
Graphene
Graphene is a client-side UI library for Minecraft that lets mod developers build interfaces with web technologies.
It embeds Chromium through JCEF, so you can render HTML/CSS/JavaScript UIs in-game while keeping a clean Java API for
mod integration.

What is Graphene?
Graphene bridges Minecraft modding and modern web UI development. Instead of building every screen with Minecraft's
rendering primitives, you can create interfaces with HTML, CSS, and JavaScript, then integrate them with your mod
through a Java API.
Graphene provides:
- interactive Chromium views that can be embedded in Minecraft screens;
- packaged asset URLs and an optional development HTTP server;
- two-way Java/JavaScript communication through an asynchronous bridge;
- browser navigation, input, downloads, dialogs, context menus, and lifecycle controls;
- off-screen browser sessions and surfaces for custom rendering integrations;
- Chromium DevTools support for inspecting and debugging pages.
Check compatibility and installation for supported Minecraft and
Loader versions.
Requirements
- Java:
25 for Minecraft 26.2 and 26.1.2, 21 for Minecraft 1.21.11
- GPU:
NVIDIA GeForce GT 720 or better
- For macOS users: macOS 12 (Monterey) or later
Supported Platforms
- macOS:
arm64, amd64
- Linux:
arm64, amd64
- Windows:
amd64, arm64
Tested Platforms
- Windows 11 with
AZERTY and QWERTY keyboard layouts
- Linux (Wayland) with
AZERTY and QWERTY keyboard layouts
- macOS 26 with
QWERTY keyboard layout
Installation
Graphene is published on Maven Central. Find the latest version on GitHub Releases,
Modrinth, or the Minecraft-version-specific Maven Central artifacts, then add
the artifact matching your target Minecraft version as a mod dependency:
repositories {
mavenCentral()
}
dependencies {
modImplementation("io.github.trethore:graphene-ui-26.2:<version>")
// Or for Minecraft 26.1.2:
// modImplementation("io.github.trethore:graphene-ui-26.1.2:<version>")
// Or for Minecraft 1.21.11:
// modImplementation("io.github.trethore:graphene-ui-1.21.11:<version>")
}
Declare Graphene as a runtime dependency in fabric.mod.json:
{
"depends": {
"grapheneui": ">=<version>"
}
}
Register your mod from its client initializer and retain the returned context:
import io.github.trethore.graphene.api.Graphene;
import io.github.trethore.graphene.api.GrapheneContext;
import net.fabricmc.api.ClientModInitializer;
public final class ExampleModClient implements ClientModInitializer {
private static GrapheneContext graphene;
@Override
public void onInitializeClient() {
graphene = Graphene.register(ExampleModClient.class);
}
public static GrapheneContext graphene() {
return graphene;
}
}
See those documentation pages for more details:
Contributing
Contributions are welcome!
- Read the contributor guide in CONTRIBUTING.md.
- Report bugs or request features in Issues.
- Open changes through Pull Requests.
- All pull requests must be tested before being submitted.
Documentation
Start HERE!
License
Licensed under the MIT License by Titouan Réthoré.
评论 0
登录后参与评分
还没有评论,来抢沙发吧