
TesseraUI
TesseraUI 是一个轻量级的 NeoForge UI 框架,允许模组开发者使用 HTML 模板、CSS 样式和本地 Minecraft 渲染来构建 Minecraft 界面。
它旨在帮助那些希望在不为每个界面手动重建布局、样式、交互和渲染逻辑的情况下,获得更丰富的客户端界面的开发者。你可以使用熟悉的类 HTML 模板和 CSS 文件定义你的 UI,将其绑定到 Java 数据和回调函数,然后让 TesseraUI 将其渲染为真实的 Minecraft GUI 组件。
TesseraUI 不嵌入浏览器,也不运行 JavaScript。模板和样式在运行时被解析并转换为可在 Minecraft 客户端内部工作的原生 UI 组件。
为什么使用 TesseraUI?
Minecraft GUI 开发很快就会变得重复:定位元素、处理悬停状态、调整布局大小、连接按钮、翻译文本、渲染物品栏以及保持大型动态列表的响应速度都需要花费大量时间。
TesseraUI 提供了一个受 Web 开发启发的结构化 UI 层,同时仍保留在 Minecraft 渲染堆栈中。你可以更快地构建界面,将表现层与 Java 逻辑分离,并在你的模组中重用 UI 模式。
它适用于以下场景:
- 配置菜单
- 指南书和文档界面
- 仪表盘和管理面板
- 类似库存的界面
- 物品选择界面
- 设置页面
- 模组管理工具
- 动态列表和数据密集型 UI
- 自定义游戏内编辑器或调试屏幕
主要功能
- 用于 Minecraft GUI 界面的 HTML 模板渲染
- 支持 Flexbox 和 Grid 布局的 CSS 样式
- CSS 变量和媒体查询
- 悬停过渡效果和关键帧动画
- 数据绑定(
{{ }}、v-for 和 v-if)
- 组件模板和插槽
- 带有
data-i18n 和翻译绑定的本地化辅助功能
- 拖放支持
- 物品栏和物品选择器支持
- 针对大数据集的虚拟列表
- 选项卡和交互式 UI 组件
- 热重载支持以加快 UI 开发速度
- 完整的程序化 Java API 用于代码优先的界面
HTML 和 CSS 模板
在你的模组资产下创建 UI 文件并从 Java 加载它们:
<col>
<h2 data-i18n="ui.example.title">Settings</h2>
<p>Hello, {{ player.name }}!</p>
<row>
<button onclick="save">Save</button>
<button onclick="cancel">Cancel</button>
</row>
</col>
col {
background: #1A1208;
padding: 12px;
gap: 8px;
}
button {
background: #5C3A1E;
color: #F0B27A;
width: 80px;
height: 16px;
transition: background 200ms ease-out;
}
button:hover {
background: #7C5A2E;
}
这使得艺术家、设计师和开发人员可以在布局和样式上进行迭代,而无需将每一个视觉决策都埋藏在 Java 代码中。
包含 Java API
如果你更喜欢直接在代码中构建界面,TesseraUI 还暴露了一个完整的 Java API。你可以以编程方式创建面板、标签、按钮、列表、动画、物品栏和交互式组件,同时使用相同的布局和渲染系统。
你也可以混合使用这两种方法:对大多数 UI 结构使用模板,然后在需要的地方附加 Java 回调、动态模型和自定义组件。
专为模组开发打造
TesseraUI 专注于 Minecraft 模组 UI 的实际需求:
- 客户端界面渲染
- 感知物品的组件
- 物品选择器支持
- 易于本地化的文本
- 可重用的组件
- 针对不同 GUI 比例的响应式布局
- 开发期间的热重载
- 无 Web 运行时依赖
目标是使复杂的模组界面更容易构建、维护和重新设计样式。
游戏内示例界面
TesseraUI 包含几个开发/演示界面,可以在游戏中打开以查看框架的实际效果。它们有助于测试功能、截取截图以及理解 HTML/CSS 模板如何映射到 Minecraft UI 组件。
推荐的演示界面:
/tessera test-v18 — 工具提示、响应式状态和 Toast 通知
/tessera test-v19 — 选项卡、模态对话框、表单、滑块和键盘焦点
/tessera test-v20 — 虚拟列表和 CSS 过渡效果
/tessera test-v21 — 可重用组件、上下文菜单和调试覆盖层工具
/tessera test-v22 — 拖放、物品栏和物品网格
/tessera test-v23 — CSS 过渡效果和关键帧动画
这些界面旨在作为模组开发人员的实用示例,而非游戏玩法内容。它们展示了如何使用 TesseraUI 构建真实的模组菜单、配置面板、类似库存的界面、仪表盘和动态客户端界面。
要求
- Minecraft 1.21.1
- NeoForge 21.1.x
- Java 21
文档
文档可在 GitHub Wiki 上找到:
Wiki 包括入门指南、支持的 HTML 标签、CSS 参考、数据绑定、布局行为、本地化、拖放、物品栏、热重载以及程序化 API。
许可证
TesseraUI 根据 LGPL-3.0 许可协议授权。

TesseraUI
TesseraUI is a lightweight UI framework for NeoForge that lets mod developers build Minecraft screens with HTML templates, CSS styling, and native Minecraft rendering.
It is designed for developers who want richer client-side interfaces without manually rebuilding layout, styling, interaction, and rendering logic for every screen. Define your UI with familiar HTML-like templates and CSS files, bind it to Java data and callbacks, then let TesseraUI render it as real Minecraft GUI widgets.
TesseraUI does not embed a browser and does not run JavaScript. Templates and styles are parsed at runtime and converted into native UI components that work inside the Minecraft client.
Why Use TesseraUI?
Minecraft GUI development can become repetitive quickly: positioning elements, handling hover states, resizing layouts, wiring buttons, translating text, rendering item slots, and keeping large dynamic lists responsive all take time.
TesseraUI gives you a structured UI layer inspired by web development while staying inside the Minecraft rendering stack. You can build screens faster, keep presentation separate from Java logic, and reuse UI patterns across your mod.
It is useful for:
- configuration menus
- guide books and documentation screens
- dashboards and admin panels
- inventory-style interfaces
- item selection screens
- settings pages
- mod management tools
- dynamic lists and data-heavy UIs
- custom in-game editors or debug screens
Key Features
- HTML template rendering for Minecraft GUI screens
- CSS styling with flexbox and grid layout support
- CSS variables and media queries
- Hover transitions and keyframe animations
- Data binding with
{{ }}, v-for, and v-if
- Component templates and slots
- Localization helpers with
data-i18n and translation bindings
- Drag and drop support
- Item slots and inventory picker support
- Virtual lists for large datasets
- Tabs and interactive UI components
- Hot reload support for faster UI development
- Full programmatic Java API for code-first interfaces
HTML and CSS Templates
Create UI files under your mod assets and load them from Java:
<col>
<h2 data-i18n="ui.example.title">Settings</h2>
<p>Hello, {{ player.name }}!</p>
<row>
<button onclick="save">Save</button>
<button onclick="cancel">Cancel</button>
</row>
</col>
col {
background: #1A1208;
padding: 12px;
gap: 8px;
}
button {
background: #5C3A1E;
color: #F0B27A;
width: 80px;
height: 16px;
transition: background 200ms ease-out;
}
button:hover {
background: #7C5A2E;
}
This lets artists, designers, and developers iterate on layout and styling without burying every visual decision inside Java code.
Java API Included
If you prefer building screens directly in code, TesseraUI also exposes a full Java API. You can create panels, labels, buttons, lists, animations, item slots, and interactive components programmatically while using the same layout and rendering system.
You can also mix both approaches: use templates for most UI structure, then attach Java callbacks, dynamic models, and custom components where needed.
Built for Mod Development
TesseraUI focuses on the practical needs of Minecraft mod UIs:
- client-side screen rendering
- item-aware widgets
- inventory picker support
- localization-friendly text
- reusable components
- responsive layouts for different GUI scales
- hot reload during development
- no web runtime dependency
The goal is to make complex mod screens easier to build, maintain, and restyle over time.
In-Game Example Screens
TesseraUI includes several development/demo screens that can be opened in-game to see the framework in action. They are useful for testing features, taking screenshots, and understanding how the HTML/CSS templates map to Minecraft UI widgets.
Recommended demo screens:
/tessera test-v18 — tooltips, reactive state, and toast notifications
/tessera test-v19 — tabs, modal dialogs, forms, sliders, and keyboard focus
/tessera test-v20 — virtual lists and CSS transitions
/tessera test-v21 — reusable components, context menus, and debug overlay tooling
/tessera test-v22 — drag and drop, item slots, and item grids
/tessera test-v23 — CSS transitions and keyframe animations
These screens are meant as practical examples for mod developers, not as gameplay content. They show how TesseraUI can be used to build real mod menus, configuration panels, inventory-style interfaces, dashboards, and dynamic client-side screens.
Requirements
- Minecraft 1.21.1
- NeoForge 21.1.x
- Java 21
Documentation
Documentation is available on the GitHub Wiki:
The wiki includes getting started guides, supported HTML tags, the CSS reference, data binding, layout behavior, localization, drag and drop, item slots, hot reload, and the programmatic API.
License
TesseraUI is licensed under LGPL-3.0.
评论 0
登录后参与评分
还没有评论,来抢沙发吧