Tango’s Dynamic Hud Lib
A small client-side Fabric library for movable HUD widgets. Provides an API that other mods can use to register HUD elements. For players, that means TangosHudLib renders and stores the widgets that another mod registers through this l
介绍
Tango’s HudLib
Tango’s HudLib is a small client-side Fabric library for movable HUD widgets.
The mod itself does not add major gameplay features. It provides an API that other mods can use to register HUD elements. For players, that means TangosHudLib renders and stores the widgets that another mod registers through this library.
In-Game Usage
- Install the mod together with Fabric API.
- Start the game with a mod that registers widgets through TangosHudLib.
- Open the
Tango's HudLibcategory in the Minecraft controls menu. - Look for
HUD Editor (<Mod Name>). - Press the assigned key in-game to open that mod’s HUD editor.
- Drag widgets with the left mouse button to move them.
- Close the editor with the same hotkey or with
Esc.
Widget positions are stored in config/tangos-hud-lib.json.
Using It In Your Own Mod
The smallest clean integration has two parts:
- A class with
staticmethods annotated with@HudWidget. - A registration call inside your
ClientModInitializer.
Example
package eu.example.mod;
import eu.tango.tangosHudLib.api.HudContent;
import eu.tango.tangosHudLib.api.HudLibrary;
import eu.tango.tangosHudLib.api.HudWidget;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.lwjgl.glfw.GLFW;
public final class ExampleModClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
HudLibrary.registerWidgets("examplemod", GLFW.GLFW_KEY_H, ExampleWidgets.class);
}
public static final class ExampleWidgets {
private ExampleWidgets() {
}
@HudWidget(id = "position")
public static HudContent position() {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player == null) {
return HudContent.builder()
.line(Text.literal("Position").formatted(Formatting.GOLD))
.line(Text.literal("No world loaded").formatted(Formatting.GRAY))
.build();
}
return HudContent.builder()
.line(Text.literal("Position").formatted(Formatting.GOLD))
.line(Text.literal(
client.player.getBlockX() + " "
+ client.player.getBlockY() + " "
+ client.player.getBlockZ()
).formatted(Formatting.WHITE))
.build();
}
}
}
Rules For @HudWidget
A widget method must:
- be
static - have no parameters
- return
HudContent - use a non-empty
id
HudContent must contain at least one non-blank line:
HudContent.builder()
.line(Text.literal("Title"))
.line(Text.literal("Content"))
.build();
API Summary
HudLibrary.registerWidgets(String ownerId, int defaultKey, Class<?> clazz)registers all@HudWidgetmethods in the class and assigns a default HUD editor hotkey.HudLibrary.registerWidgets(String ownerId, Class<?> clazz)registers widgets without a default hotkey.HudLibrary.registerWidgets(Class<?> clazz)uses the library defaultstangos-hud-libandH.
常见问题
Tango’s Dynamic Hud Lib 支持哪些 Minecraft 版本?
Tango’s Dynamic Hud Lib 支持 Minecraft Java 版 1.21.10–26.2,共 4 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。
Tango’s Dynamic Hud Lib 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。
Pankraz01 的其他作品
查看全部 →ScamScreener for Hypixel SkyBlock
监控聊天内容,并提醒你注意潜在的骗子
MarketGuard for Hypixel SkyBlock
保护你避免意外出价过高或过低
GriefLogger Rollback Addon (GLRA)
Addon for GriefLogger by DAQUEM to use Rollback Command + Webinterface
Villager Trade
Lets you spawn custom villagers with custom trade options
评论
登录后评论和评分