跳到正文

tooltipfix_wuliao

作者:wuliaoppx

Backports resource pack features from newer versions to older versions, with a primary focus on optimizing CozyUI.

收藏

介绍

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

TooltipFix · Tooltip Fix

Brings the resource pack GUI appearance made for 1.21.2 to 1.20.1 / 1.21.1 / 1.12.2, and fixes the mis-rendered system toast on 1.21.11 / 26.1.2. This mod is entirely AI-created.

What does this mod do?

Starting from Minecraft 1.21.2, resource packs can redraw the in-game item tooltips, slot highlights, button backgrounds, inventory UI, and more. But 1.20.1 and 1.21.1 don’t recognize this approach—if you load a new-version resource pack, these textures are simply ignored, and the UI still looks the same as before.

This mod fills that gap: it lets older versions display the GUI appearance drawn by new-version resource packs, without switching game versions and without requiring extra work from resource pack authors.

On 1.21.4 and later the toast (system notification) background also picked up a rendering bug of its own: the nine-slice borders get clamped one by one, so any resource pack with a tall top border has its icon squashed. This mod fixes that too.

Supported Versions

Game Version Required Loader Mod Version What it does
1.12.2 Forge 14.23.5.2864 1.0.0 Tooltips + HD font engine
1.20.1 Fabric 1.0.29 Tooltips + GUI overhaul + toast fix
1.20.1 Forge 47.x 1.0.29 Tooltips + GUI overhaul + toast fix
1.21.1 Fabric 1.0.6 Tooltips + slot highlights + toast fix
1.21.1 NeoForge 21.1.x 1.0.8 Tooltips + slot highlights + toast fix
1.21.11 Fabric 1.0.0 Toast fix only
1.21.11 NeoForge 21.11.x 1.0.0 Toast fix only
26.1.2 Fabric 1.0.0 Toast fix only
26.1.2 NeoForge 26.1.x 1.0.0 Toast fix only

Please download the row that exactly matches your game version and loader.

What you’ll see after installing

  • Item tooltips: Background and border are displayed as the resource pack intends, including animated borders.
  • Slot highlights: The highlight box that appears when hovering over inventory slots.
  • GUI overhaul (1.20.1 version): Hotbar, selection box, offhand slot, XP bar, jump bar, attack indicator, button backgrounds, potion effect background.
  • System toasts (1.20.1 / 1.21.1 / 1.21.11 / 26.1.2): “Chat messages can’t be verified”, “World backed up”, advancement and tutorial toasts keep their rounded corners and their icon at the correct proportion, no matter how wide or tall the toast is.
  • HD font engine (1.12.2 version): 1.13+ font packs (bitmap / ttf / plain ascii.png) are rendered natively, with per-glyph fallback to the vanilla unicode pages for CJK.
  • In-game settings (1.12.2 version): A settings button at the bottom-left of the resource pack screen, with font engine toggle, title hiding, a CozyUI preset, font size, glyph offset and letter spacing.

The two 1.21.1 versions only handle tooltips, slot highlights and toasts; the GUI overhaul is exclusive to the 1.20.1 version.

System toast fix

On 1.21.4+ the vanilla renderer draws a nine-sliced toast background like this:

int left   = Math.min(border.left(),   width  / 2);
int top    = Math.min(border.top(),    height / 2);
int right  = Math.min(border.right(),  width  / 2);
int bottom = Math.min(border.bottom(), height / 2);

Every border is clamped independently, so a resource pack with border.top = 26 (CozyUI does exactly that) gets its top border cut to 16 on a one-line toast (32 px tall) and to 22 on a two-line toast (44 px tall): the “!” icon is squashed, and it is squashed differently on each toast height.

This mod replaces that with a single uniform scale — k = min(width / baseWidth, height / baseHeight) — and never lets a border collapse, so the corners and the icon keep their original proportions while only the middle sections stretch.

On 1.20.1 the same fix takes over the hand-written three-part tiling of textures/gui/toasts.png, which otherwise produces visible seams on 4× HD atlas packs.

Compatibility with ModernUI

If ModernUI is installed, ModernUI draws the tooltip by default and this mod stays out of the way.

ModernUI renders the tooltip itself at HIGH priority and then cancels the event at LOW priority, so the vanilla path (which is where this mod hooks in) never runs — the “only the modern tooltip shows up” symptom. The mod ships a switch, config/tooltipfix-tooltip.txt (commented, takes effect within 0.25 s, no restart):

Value Behaviour
auto (default) ModernUI draws it if present, otherwise TooltipFix
tooltipfix Always use TooltipFix’s resource pack frame (sets ModernUI’s TooltipRenderer.sTooltip to false, restores it when you switch back)
vanilla Never take over; keep whatever vanilla or another mod draws

Installation

  1. Install the corresponding loader (Fabric / Forge / NeoForge) for your version, and place this mod’s jar into the game’s mods folder;
  2. Place the resource pack made for 1.21.2 into the resourcepacks folder and enable it in-game;
  3. Launch the game.

A few notes:

  • The mod is client-side only. It works in both singleplayer and multiplayer, and does not need to be installed on the server.
  • If the resource pack doesn’t include a certain texture, that spot automatically falls back to vanilla appearance—no missing-texture purple-black checkerboards.
  • None of the versions require Fabric API or any other dependency.
  • The icon of the mod in the mod list is its own icon.png; no extra setup needed.

Usage Notes

  • A resource pack made for 1.21.2 is required for any visible effect of the tooltip / GUI part; regular resource packs won’t trigger it. The toast fix, on the other hand, works with any pack that ships toast/system.png.
  • Animated borders play frame by frame at the speed set by the resource pack, without interpolation between frames.
  • The “per-item tooltip style” feature from 1.21.2 is a new-version game mechanic and has not been ported.
  • Once installed, tooltips and slot highlights use the resource pack’s rendering, so other mods that modify the colors of these elements may no longer take effect—this is also how 1.21.2 behaves natively.
  • The 1.20.1 version only handles the UI elements that resource packs can actually modify; sliders, text fields, and checkboxes retain their older-version appearance.
  • The 1.12.2 version is a Forge coremod (there is no Mixin on 1.12.2) and hooks the bytecode of Gui / GuiScreen / FontRenderer; everything it replaces is conditional on the resource pack actually providing that texture.

License

MIT License. Free to use, modify, and redistribute.

Minecraft is a trademark of Mojang Studios. This mod is not affiliated with Mojang or any loader team.


TooltipFix · 提示框修复

让 1.20.1 / 1.21.1 / 1.12.2 也能用上为 1.21.2 制作的材质包界面外观,并修好 1.21.11 / 26.1.2 上画歪的系统提示框。本模组完全由 AI 创作。

这个模组是干什么的

从 Minecraft 1.21.2 开始,材质包可以重新绘制游戏里的物品提示框、格子高亮框、按钮底板、物品栏这些东西。 但 1.20.1 和 1.21.1 不认这套做法——把新版材质包装上去,这些贴图会被直接忽略,界面看起来还是老样子。

本模组就是补上这一块:让老版本也能显示新版材质包画的界面外观,不需要换游戏版本,也不需要材质包作者做额外适配。

1.21.4 起,系统提示框(toast,就是右上角「无法验证聊天消息」「已备份世界」那种小面板)自己也有一个绘制问题:九宫格的边框被逐条截断,材质包只要把上边框画高一点,图标就会被压扁。这一点本模组一并修掉。

支持版本

游戏版本 需要的加载器 本模组版本 这一行做什么
1.12.2 Forge 14.23.5.2864 1.0.0 物品提示框 + HD 字体引擎
1.20.1 Fabric 1.0.29 提示框 + 界面美化 + 系统提示框修复
1.20.1 Forge 47.x 1.0.29 提示框 + 界面美化 + 系统提示框修复
1.21.1 Fabric 1.0.6 提示框 + 格子高亮 + 系统提示框修复
1.21.1 NeoForge 21.1.x 1.0.8 提示框 + 格子高亮 + 系统提示框修复
1.21.11 Fabric 1.0.0 只修系统提示框
1.21.11 NeoForge 21.11.x 1.0.0 只修系统提示框
26.1.2 Fabric 1.0.0 只修系统提示框
26.1.2 NeoForge 26.1.x 1.0.0 只修系统提示框

请下载与你的游戏版本、加载器完全对应的一行。

装上之后能看到什么

  • 物品提示框:底板和边框都按材质包的样子显示,支持会动的边框。
  • 格子高亮框:鼠标悬停在物品栏格子上时出现的高亮框。
  • 界面美化(1.20.1 版):快捷栏、选中框、副手栏、经验条、跳跃条、攻击指示器、按钮底板、药水效果背景。
  • 系统提示框(1.20.1 / 1.21.1 / 1.21.11 / 26.1.2):不论提示框多宽多高,「无法验证聊天消息」「已备份世界」、成就与教程提示都保持圆角和原始比例的图标,不再被压扁。
  • HD 字体引擎(1.12.2 版):直接读 1.13+ 的字体包(bitmap / ttf / 只有一张 ascii.png 的老式字体包),缺字形时逐字符回退原版 unicode 页,中文照常显示。
  • 游戏内设置界面(1.12.2 版):资源包界面左下角有设置入口,含字体引擎开关、隐藏容器标题、CozyUI 预设、字号、字形偏移、字间距。

1.21.1 的两个版本只负责提示框、格子高亮框和系统提示框这三块,界面美化留给 1.20.1 版。

系统提示框修复

1.21.4 之后,原版画九宫格背景是这样算的:

int left   = Math.min(border.left(),   width  / 2);
int top    = Math.min(border.top(),    height / 2);
int right  = Math.min(border.right(),  width  / 2);
int bottom = Math.min(border.bottom(), height / 2);

四条边框各自被截到目标尺寸的一半。材质包如果写了 border.top = 26(CozyUI 就是),单行提示只有 32 高,上边框被截成 16;两行提示 44 高,被截成 22——于是「!」图标被纵向压扁,而且不同高度的提示压缩比例还不一样。

本模组改成统一比例缩放:k = min(宽 / 基准宽, 高 / 基准高),并且保证边框不会被压没,这样四个角和图标保持原始比例,只有中段被拉伸。

在 1.20.1 上,同一个修复接管的是 textures/gui/toasts.png 那套手写的三段横向平铺——否则 4 倍 HD 图集的包会在接缝处出现明显的分界线。

与 ModernUI 共存

装了 ModernUI 时,默认使用 ModernUI 的提示框,本模组不抢。

ModernUI 会用 HIGH 优先级自己画提示框,再用 LOW 优先级把事件取消,原版路径(也就是本模组的注入点)被短路,表现就是「只显示现代化 UI 的提示框」。模组提供了开关 config/tooltipfix-tooltip.txt(带注释,保存后 0.25 秒内生效,不用重启):

取值 行为
auto(默认) 装了 ModernUI 就让给它,没装就用 TooltipFix
tooltipfix 始终用 TooltipFix 的材质包外框(会把 ModernUI 的 TooltipRenderer.sTooltip 置为 false,切回时还原)
vanilla 始终不接管,保留原版或其它模组画的外框

安装方法

  1. 先装好对应版本的加载器(Fabric / Forge / NeoForge),把本模组的 jar 放进游戏的 mods 文件夹;
  2. 把面向 1.21.2 制作的材质包放进 resourcepacks 文件夹,并在游戏里启用;
  3. 启动游戏。

几点说明:

  • 模组只在客户端工作,单人和多人服务器都能用,服务器端不需要安装。
  • 材质包没有画某张贴图时,那个位置会自动变回原版样子,不会出现紫黑格子。
  • 所有版本都不需要 Fabric API,也不需要其他前置模组。
  • 模组列表里显示的图标就是包里自带的 icon.png,不需要额外设置。

使用须知

  • 提示框 / 界面美化部分必须搭配面向 1.21.2 的材质包才有可见效果,普通材质包不会调用到它;系统提示框修复则对任何提供 toast/system.png 的材质包生效。
  • 会动的边框按材质包设定的速度一帧一帧播放,不做帧间平滑过渡。
  • 1.21.2 里「给每件物品单独指定提示框样式」属于新版本的游戏设定,没有一起移植过来。
  • 装上之后,提示框和格子高亮框改用材质包的画法,其他模组改这两块颜色的功能可能不再生效——1.21.2 本身也是这个表现。
  • 1.20.1 版只处理材质包真正能改的那几块界面,滑条、输入框、勾选框仍然保持老版本外观。
  • 1.12.2 版是 Forge coremod(1.12.2 没有 Mixin),直接改写 Gui / GuiScreen / FontRenderer 的字节码;每一处替换都以「材质包确实提供了这张贴图」为前提,没有就原样回退。

许可

MIT 许可,可自由使用、修改和再分发。

Minecraft 是 Mojang Studios 的商标,本模组与 Mojang 及各加载器团队没有隶属关系。

常见问题

tooltipfix_wuliao 支持哪些 Minecraft 版本?

tooltipfix_wuliao 支持 Minecraft Java 版 1.12.2–26.1.2,共 5 个版本,可用的加载器:Fabric / Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。

tooltipfix_wuliao 怎么安装?

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

评论

登录后评论和评分

wuliaoppx 的其他作品

查看全部 →