ZEHU — Zap's Enhanced HUD Utilities
一款面向 Minecraft 1.21.11、26.1.x 及 26.2(Fabric 版)的高性能模块化 HUD 实用模组。
概览
ZEHU — Zap's Enhanced HUD Utilities 是一款专为 Minecraft 1.21.11、26.1.x 和 26.2 设计的 HUD 模组。ZEHU 旨在提供必要的 HUD 实用功能,采用简洁的模组形式,不捆绑于专有启动器中,支持与分辨率无关的相对缩放,并拥有零垃圾回收的渲染例程。
本模组不仅包含了其他杂项和生存类实用功能,还涵盖了核心的 PvP HUD 实用工具,并为每项特定实用工具提供了多种主题风格。
警告
[!Warning]
该模组目前正处于开发阶段,并将持续进行开发。如果存在 Bug,或者你发现某些功能打磨得不够完善,这是由于模组仍在开发中。如果你发现任何 Bug 或需要改进的地方,请在 Github 源码仓库 提交 Issue。我是独立开发者,没有足够的时间去检查模组的每一个角落,因此非常感谢你向我报告问题,以便我进行检查和修复。
主要功能 & 提供模块
1. 护甲与装备 HUD
- 实时耐久度追踪:显示当前装备的头盔、胸甲、护腿和靴子的实时耐久条、原始数值或百分比。
- 低耐久度警告:当装备耐久度低于可配置的阈值(百分比或原始耐久点数)时,触发视觉警告高亮。
- 灵活布局:支持垂直或水平堆叠、反转渲染顺序以及自定义文本位置。
2. 按键输入 HUD
- 实时输入显示:显示 WASD、鼠标左/右键、左 Shift、Control 和空格键的输入状态。
- 集成 CPS 指示器:在鼠标按键图标内直接显示实时的每秒点击次数。
3. 战斗实用工具(连击、攻击距离、延迟、CPS)
- 连击计数器
- 攻击距离显示
- 延迟监控
- CPS 计数器
- FPS 计数器
4. 导航(坐标、速度计与指南针)
- 坐标 HUD:显示 X、Y、Z 坐标、面朝方向(北、南、东、西)、当前生物群系,以及自动计算的末地坐标。
- 速度计:以米/秒 ($m/s$) 为单位跟踪水平移动速度。
- 指南针条:平滑的线性指南针条,包含玩家头部图标(
PlayerFaceExtractor)和方位刻度标记。
5. 物品追踪 HUD
- 自定义物品计数:追踪特定库存物品(末影珍珠、金苹果、箭、图腾等),并显示实时数量叠加层。
- 物品搜索与选择界面:内置注册表搜索界面,可快速选择要追踪的物品。
- 药水与堆叠叠加层:显示活跃药水效果的实时持续时间指示器和物品堆叠数量。
7. 自定义准星
[!WARNING]
正在开发与改进中,尚未达到可用状态
- 矢量样式:可选择
DOT(点)、CROSS(十字)、CIRCLE(圆)、ARROW(箭头)或 VANILLA(原版)。
- 精确参数:完全可调的间隙、线条粗细、外部大小以及 RGB/Hex 颜色。
8. Boss 血条
[!WARNING]
正在开发与改进中,尚未达到可用状态
- 单条与多条堆叠:为多个活跃的 Boss 血条提供自定义堆叠方向(
UP 向上 或 DOWN 向下)。
- 统一边界框选择:编辑器中的边界框将所有活跃的 Boss 血条作为一个单一的交互元素包围在一起。
交互式拖拽编辑器 (HudLayoutScreen)
在游戏中按下 Right Shift(可配置)以启动 HUD 布局编辑器。
- 像素网格吸附:将小部件对齐到覆盖网格,以实现整洁的定位。
- 动态对齐辅助线:在移动过程中动态出现青色和紫色的吸附线,用于将元素与屏幕中心或相邻的小部件对齐。
- 八点缩放手柄:拖动角点或中点以独立缩放 X 和 Y 维度($25% \text{--} 200%$)。
- 相对屏幕缩放:将坐标存储为相对于屏幕的百分比(
relativeX, relativeY),确保你的 HUD 布局在不同显示器(1080p、1440p、4K)或 GUI 缩放比例下保持居中。
- 编辑器内上下文菜单:点击任意小部件的设置图标,打开一个毛玻璃风格的弹出面板,用于调整颜色、缩放和模块特定的开关。
技术架构与性能效率
ZEHU 专门设计用于消除重型 HUD 模组中常见的微卡顿和帧率尖峰。
1. 渲染循环中的零垃圾分配
标准 HUD 模组会在每一帧实例化新的 String、Component 或 Vector 对象,导致频繁的 Java 垃圾回收 (GC) 暂停。
- 缓存格式化序列:ZEHU 缓存字符串表示和原始颜色整数。
- 原始缓冲区:CPS、连击和速度计的计算使用固定大小的原始数组(
long[] / float[]),以防止在渲染期间发生堆分配。
2. 事件驱动的时间窗口采样
与其每 tick 持续轮询实体列表或迭代库存:
- 点击与命中:在原生输入事件中捕获,并存储在环形缓冲区中。
- 物品追踪:仅在库存 tick 事件时评估库存数量,从而降低 CPU 开销。
3. 精准 Mixin 拦截
ZEHU 使用目标明确的 SpongePowered Mixins(GuiMixin, BossHealthOverlayMixin)来拦截原版 GUI 渲染例程(extractEffects, extractCrosshair, extractRenderState):
- 当启用 ZEHU 模块时,对应的原版渲染例程会在
@At("HEAD") 处被取消。
- 这避免了双重渲染开销,并防止纹理缓冲区竞争。
4. GPU 状态提取 (GuiGraphicsExtractor)
专为 Fabric 1.21.11、26.1.x 和 26.2 设计,ZEHU 利用 Mojang 的现代 GuiGraphicsExtractor 管线(extractRenderState)。渲染通道被直接批处理到 GPU 管线中,避免了不必要的矩阵堆栈压入和绘制调用分割。
配置与安装
需求
- Minecraft:
1.21.11, 26.1.x 或 26.2.x
- Fabric Loader:
>=0.19.0
- Fabric API
配置文件
配置数据自动保存至:
.minecraft/config/zehu.json
路线图与未来开发
- HUD 配置文件导入/导出
- 帧时间与 CPS Sparklines(迷你折线图)
- 航点与信标追踪
- 自定义光影背景
- 切换疾跑/潜行
- 全亮模式切换
- 可定制的 F3 显示模组
- 粒子更改器
- 时钟
- 库存 HUD
- 自定义字体及对 HUD 字体的更多控制
- 背景透明度滑块
- 色相颜色循环
许可证
依据 LGPLv3 许可证 分发。由 Zapaxe 创建。
ZEHU — Zap's Enhanced HUD Utilities
A high-performance, modular, HUD utility mod for Minecraft 1.21.11, 26.1.x & 26.2 on Fabric.
Overview
ZEHU — Zap's Enhanced HUD Utilities is a HUD mod designed for Minecraft 1.21.11, 26.1.x and 26.2. ZEHU aims to provide essential HUD utilities in a simple mod without being bundled in with proprietary launchers, resolution-independent relative scaling, and zero-garbage rendering routines.
Essential PvP HUD utilities as other miscellaneous and survival based utilities are included in this mod as well as different themes for each of these specific utilities.
Warning
[!Warning]
This mod is currently and will be in development, If there are bugs, or if you find somethings that are not polished enough that is due to this mod still being in development, If you find any bugs or you find things that needs more improvement please open a issue at the Github source repository. I'm a Solo Developer and I don't have the time to look at every nook and cranny of this mod so I would really appreciate it if you can report them to me so i can take a look at it.
Key Features & Offered Modules
1. Armour & Equipment HUD
- Live Durability Tracking: Displays equipped helmet, chestplate, leggings, boots with live durability bars, raw numbers, or percentages.
- Low-Durability Warnings: Visual warning highlights trigger when equipment durability drops below configurable thresholds (percentage or raw durability points).
- Flexible Layouts: Supports vertical or horizontal stacking, reversed rendering order, and customizable text positioning.
2. Keystrokes & Input HUD
- Real-Time Input Display: Displays WASD, Left/Right Mouse Buttons, Left Shift, Control, and Spacebar inputs.
- Integrated CPS Indicators: Displays live clicks-per-second directly inside the mouse button keys.
3. Combat Utilities (Combo, Reach, Ping, CPS)
- Combo Counter
- Reach Display
- Ping Monitor
- CPS Counter
- FPS Counter
4. Navigation (Coords, Speedometer & Compass)
- Coords HUD: Displays X, Y, Z position, cardinal facing direction (North, South, East, West), current biome, and automatic Nether coordinate calculations.
- Speedometer: Tracks horizontal travel speed in meters per second ($m/s$).
- Compass Ribbon: A smooth linear compass strip featuring player head icons (
PlayerFaceExtractor) and cardinal tick markers.
5. Item Tracker HUD
- Custom Item Count: Track specific inventory items (Ender Pearls, Golden Apples, Arrows, Totems, etc.) with live count overlays.
- Item Search & Selector Screen: Built-in registry search screen to quickly select items for tracking.
- Potion & Stack Overlays: Live duration indicators for active potion effects and item stack counts.
7. Custom Crosshair
[!WARNING]
Currently Being Worked On and Improved, Not at a Usable State
- Vector Styles: Choose from
DOT, CROSS, CIRCLE, ARROW, or VANILLA.
- Precision Parameters: Fully adjustable gap, line thickness, outer size, and RGB/Hex colors.
8. Boss Bar
[!WARNING]
Currently Being Worked On and Improved, Not at a Usable State
- Single & Multi-Bar Stacking: Custom stack directions (
UP or DOWN) for multiple active boss bars.
- Unified Bounding Box Selection: Editor bounding boxes enclose all active boss bars together as a single interactive element.
Interactive Drag-and-Drop Editor (HudLayoutScreen)
Press Right Shift (configurable) in-game to launch the HUD Layout Editor.
- Pixel-Grid Snapping: Align widgets to an overlay grid for clean positioning.
- Dynamic Alignment Guidelines: Cyan and purple snap lines appear dynamically during movement to align elements with screen center or adjacent widgets.
- Eight-Point Scale Handles: Grab corners or midpoints to scale X and Y dimensions independently ($25% \text{--} 200%$).
- Relative Screen Scaling: Stores coordinates as screen-relative percentages (
relativeX, relativeY), ensuring your HUD layout stays centered across different monitors (1080p, 1440p, 4K) or GUI scales.
- In-Editor Context Menu: Click any widget's gear icon to open a glassmorphic popup panel for tweaking colors, scale, and module-specific toggles.
Technical Architecture & Performance Efficiency
ZEHU is engineered specifically to eliminate micro-stutters and frame spikes common in heavy HUD mods.
1. Zero Garbage Allocation in Render Loop
Standard HUD mods instantiate new String, Component, or Vector objects every single frame, causing frequent Java Garbage Collection (GC) pauses.
- Cached Formatted Sequences: ZEHU caches string representations and primitive color integers.
- Primitive Buffers: Calculations for CPS, Combo, and Speedometer use fixed-size primitive arrays (
long[] / float[]) to prevent heap allocation during rendering.
2. Event-Driven Time-Window Sampling
Rather than continuously polling entity lists or iterating inventories every tick:
- Clicks & Hits: Captured on native input events and stored in circular ring-buffers.
- Item Tracking: Inventory counts are evaluated only on inventory tick events, reducing CPU overhead.
3. Surgical Mixin Interceptions
ZEHU uses targeted SpongePowered Mixins (GuiMixin, BossHealthOverlayMixin) to intercept vanilla GUI render routines (extractEffects, extractCrosshair, extractRenderState):
- When a ZEHU module is enabled, the corresponding vanilla render routine is canceled at
@At("HEAD").
- This avoids double-rendering overhead and prevents texture buffer fighting.
4. GPU State Extraction (GuiGraphicsExtractor)
Designed for Fabric 1.21.11, 26.1.x and 26.2, ZEHU utilizes Mojang's modern GuiGraphicsExtractor pipeline (extractRenderState). Render passes are batched directly into GPU pipelines, avoiding unnecessary matrix stack pushes and draw call splits.
Configuration & Installation
Requirements
- Minecraft:
1.21.11, 26.1.x or 26.2.x
- Fabric Loader:
>=0.19.0
- Fabric API
Configuration File
Config data is automatically saved to:
.minecraft/config/zehu.json
Roadmap & Future Developments
- HUD Profile Import / Export
- Frame Time & CPS Sparklines
- Waypoints & Beacon Tracking
- Custom Shader Backdrops
- Toggle Sprint/Sneak
- Fullbright Toggle
- Customizable F3 Display Mod
- Particle Changer
- Clock
- Inventory HUD
- Custom Fonts & More Control Over HUD Fonts
- Background Opacity Sliders
- Chroma Color Cycles
- And tons of more modules
License
Distributed under the LGPLv3 License. Created by Zapaxe.
评论 0
登录后参与评分
还没有评论,来抢沙发吧