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;
}
}
请参阅以下文档页面以获取更多详细信息:
- 兼容性和安装 包含兼容性详情
- 第一个 Web 屏幕教程 提供完整示例
贡献
欢迎贡献!
- 阅读 CONTRIBUTING.md 中的贡献者指南。
- 在 Issues 中报告错误或请求功能。
- 通过 Pull Requests 提交更改。
- 所有拉取请求在提交前必须经过测试。
文档
请从这里开始 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:
25for Minecraft 26.2 and 26.1.2,21for Minecraft 1.21.11 - GPU:
NVIDIA GeForce GT 720or 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
AZERTYandQWERTYkeyboard layouts - Linux (Wayland) with
AZERTYandQWERTYkeyboard layouts - macOS 26 with
QWERTYkeyboard 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:
- compatibility and installation for compatibility details
- first web-screen tutorial for a complete example
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é.
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
下载 Graphene
移除
- 移除了已弃用的
BrowserSurface和BrowserSurfaceInputAdapter兼容 API,以及对应的GrapheneWebViewWidget构造函数。
修复
- 在开发环境中将共享模块发布为
graphene-ui-common,同时在运行时 JAR 中保留其嵌入形式。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧