跳到正文

UI Timer Lib

作者:FilXD

A simple UI timer for mod creators, made to be as easy to use a possible.

收藏

截图

介绍

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

UI Utils

UI Utils is a small Fabric library that makes it easy to display simple HUD elements without having to write your own renderer.

It is designed for mod developers who want a quick and lightweight way to show text and timers on the player’s screen.

Here is an example of this library in use.

2026-06-15-11-15-40

Features

  • Display custom text on the HUD
  • Show live countdown timers
  • Change text and background colors easily
  • Show and hide the overlay
  • Lightweight and easy to integrate into other mods

Setting it up

  • Download the latest ui-utils-<version>.jar from the Versions tab.
  • Add the JAR to your project dependencies.
  • Add UI Utils as a dependency in your mod.

fabric.mod.json

  {
    "depends": {
      "fabricloader": "*",
      "minecraft": "1.21.6",
      "ui-utils": "*"
    }
  }
  • Import within your Java file.

Main.java

  import com.uitutils.UIUtils;

Usage

  • Show a labeled timer
UIUtils.show(String label, int seconds);
  • Hide timer
UIUtils.hide();
  • Set timer value
UIUtils.setTime(int seconds);
  • Set timer color (24-bit RGB hexadecimal integer)
UIUtils.setColor(int rgb);
  • Set background color (24-bit RGB hexadecimal integer)
UIUtils.setBackground(int rgb);

Internal fields

These fields exist for direct access but are not required for normal usage.

  • Query current HUD text string
UIUtils.text;
  • Query countdown value in seconds
UIUtils.secondsRemaining;
  • Query HUD visibility
UIUtils.visible;
  • Query HUD text color
UIUtils.color;
  • Query background color
UIUtils.background;

常见问题

UI Timer Lib 支持哪些 Minecraft 版本?

UI Timer Lib 支持 Minecraft Java 版 1.21.6–1.21.11,共 6 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

UI Timer Lib 怎么安装?

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

评论

登录后评论和评分

FilXD 的其他作品

查看全部 →