跳到正文

Minecraft Flex UI

作者:moheng233

Implement a Flex layout-based Minecraft GUI framework based on facebook's open source Yoga layout engine.

收藏

截图

介绍

中文介绍正在准备中,下面暂时显示原文。

Minecraft Flex UI

For ordinary players do not download the mod

In most cases the module is used by other module developers and is included in their mod Jar package

Description

Based on facebook open source Yoga layout engine implements the Minecraft GUI framework based on the Flex layout.

A subset of the Flex standard is implemented on top of Yoga and most of the CSS properties are implemented as well.

The design concept of MVC is adopted to realize the one-way and two-way data binding.

Developers can design and implement complex UI interfaces on top of this, and this project can be used as Yoga engine embedded in the game as a non-exhaustive reference implementation of the game layout engine.

Example

example

public class WidgetTestScreen extends WidgetScreen {
	protected StringBuilderObservable text = new StringBuilderObservable();

	public WidgetTestScreen() {
		super(Text.of("test"));
	}

	@Override
	public void widget(ScreenWidget root) {
		root.flexDirection.set(WidgetFlexDirection.Row)
				.justifyContent.set(WidgetJustify.Center)
				.alignItems.set(WidgetAlign.Center)
				.child(new BoxWidget()
						.background.set(RectDrawable.LIGHT_PANEL)
						.child(new LabelWidget()
								.text.binding(text.computed((StringBuilderObservable text) -> Text.of(text.getString())))
								.margin(WidgetEdge.All, 4))
						.child(new TextBoxWidget()
								.text.binding(text))
						.child(new ButtonWidget()
								.click.on((mouse) -> close())
								.child(new LabelWidget()
										.text.set(Text.of("取消"))))
				);
	}
}

Data Binding

By default all bindings from non-computed binding sources are bi-directional bindings.

Setting values for computed binding sources is ignored

But most components will only operate one-way on bound values

常见问题

Minecraft Flex UI 支持哪些 Minecraft 版本?

Minecraft Flex UI 支持 Minecraft Java 版 1.19–1.19.3,共 4 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

Minecraft Flex UI 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端和服务端都要装。

评论

登录后评论和评分