简介
Tau 是用于 Minecraft Forge 的一个 UI 库,旨在简化图形用户界面(GUI)的创建过程。它提供了类似 Flutter 的语法,用于创建和自定义 UI 元素的外观,使开发者能够轻松构建美观、响应迅速且功能完善的界面。
主要特性
- 类 Flutter 语法:Tau 使用与 Flutter 类似的语法,使得熟悉 Flutter 的开发者能够快速上手 Tau。
- 可扩展性:Tau 设计为可扩展的,允许开发者向库中添加自定义的 UI 元素和组件。
- 易于使用:Tau 设计得简单易用。我个人非常不喜欢制作 Minecraft UI 时的现有工作流。Tau 将这一工作流转变为更有序、更易维护的方式(以我的观点而言)。
功能
目前,Tau 拥有两种渲染器。它们基于现有的 Minecraft UI 渲染器构建。其中一种用于屏幕(Screen),另一种用于 HUD。因此,你可以根据需要使用 Tau 构建 HUD 和各种类型的屏幕。截至目前(版本 1.0.0),尚不支持为容器(Containers)制作 UI。但这正是我希望未来探索的方向。
示例
以下是一些可用于设置简单 Tau UI 的代码示例:
public class ExampleUI implements UIComponent {
@Override
public UIComponent build(Layout layout) {
return new Stack(
new Container.Builder().withColor(Color.WHITE),
new Center(new Sized(
Size.staticSize(new Vector2i(100, 20)),
new TextField.Builder()
.withMessage(new StringTextComponent("Hello"))
.withHintText(new StringTextComponent("Hello!")))
));
}
}
在该代码片段中,它创建了一组相互堆叠的 UI 元素。在这种情况下,是一个填充了白色的空容器,以及一个尺寸为 100(宽) x 20(高) 并居中显示的文本字段,其叙述消息为 "Hello",提示文本为 "Hello!"。
最后,可以通过以下代码将该 UI 显示到屏幕上:
Minecraft.getInstance().setScreen(new ScreenUIRenderer(new TestStatic()));
快速开始
你可以访问文档网站 此处
Summary
Tau is a UI library for Minecraft Forge that simplifies the process of creating graphical user interfaces (GUIs). It provides a Flutter-like syntax for creating and customizing the appearance of UI elements, making it easy for developers to create attractive, responsive, and functional interfaces.
Key Features
- Flutter-like Syntax: Tau uses a syntax similar to that of Flutter, making it easy for developers familiar with Flutter to get started with Tau.
- Extensible: Tau is designed to be extensible, allowing developers to add their own custom UI elements and widgets to the library.
- Easy To Use: Tau is designed to be easy to use. I am personally really not a fan of the workflow that goes into making Minecraft UIs. Tau changes that workflow into a more organized and maintainable fashion (In my opinion).
Capabilities
Currently, there are 2 renderers for Tau. They are built upon existing Minecraft UI renderers. There is one for Screen and another one for Hud. So you can use Tau to build Huds and various different types of screens as you need. There is currently no support for making UI for containers (as of version 1.0.0). But that is something I would like to look into.
Example
Here are some example code that can be used to set up a simple Tau UI
public class ExampleUI implements UIComponent {
@Override
public UIComponent build(Layout layout) {
return new Stack(
new Container.Builder().withColor(Color.WHITE),
new Center(new Sized(
Size.staticSize(new Vector2i(100, 20)),
new TextField.Builder()
.withMessage(new StringTextComponent("Hello"))
.withHintText(new StringTextComponent("Hello!")))
));
}
}
in this snippet, it creates a list of UI elements that stack on top of each other. In this case, an empty container filled with the color white, and a text field with the size 100(w) 20(h) centred in the middle of the screen with a narration message of "Hello" and a hint text of "Hello!"
Lastly, This UI can be displayed onto the screen with
Minecraft.getInstance().setScreen(new ScreenUIRenderer(new TestStatic()));
Getting Started
You can head to the documentation website here
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
下载 Tau
v2.0.0 NeoForge-1.20.6 重大更新 - 自 Tau 1.0.3-1.19 以来的变更
API 变更
Vector2i重命名为SimpleVec2i- 主题签名更改以适配新的 Minecraft
GuiGraphicsAPI - 移除了
ScaleTransform和TranslationTransform Transformation不再是接口,而是类- 在 Transform 类中添加了
scale和translate方法以替代ScaleTransform和TranslationTransform Transform组件现在也会对其子组件接收到的输入进行变换PrimitiveComponent#build现在接受BuildContext而非列表- 在
Tooltip中添加了ClientTooltipPositioner参数 - 添加了
menu包- 为 Tau 添加了容器/菜单支持
- Tau 现在可用于创建带有库存的 UI
- 添加了新的
PlayerInventory和ItemSlot组件(这些组件仅在TauMenu中生效)
内部变更
ListView不再按子组件滚动,而是按固定量滚动DynamicUIComponent不再暴露危险字段
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧