Custom Tooltip API
Custom Tooltip API 是一款功能强大的客户端 Minecraft 模组及开发者库,让你完全掌控物品工具提示(Tooltip)。添加自定义背景故事、动态实时数据、动画渐变和自定义背景,所有设置均可在游戏内或通过代码进行配置。
基础使用无需编写代码,因为它提供了一个强大的游戏内界面并支持完整的 JSON。同时,它也提供了稳健的 Developer API,供希望以编程方式注入工具提示的开发者使用。
主要特性
-
图标对齐: 将来自外部资源包的工具提示图标对齐到行首,确保位置一致!
-
高级目标定位: 针对特定的物品 ID(minecraft:diamond_sword)、标签组(#c:swords)、整个模组命名空间(minecraft:*)、正则表达式模式(regex:.*_sword),或一次性针对所有物品(*)。
-
动态占位符: 使用 %durability%、%max_durability%、%weapon_damage% 或 %enchantments% 等变量,将实时的物品数据直接嵌入文本中。你还可以使用 <key:key.jump> -> [Space] 格式嵌入快捷键提示。
-
多行支持(背景故事): 添加整段的背景故事或技能描述。
-
视觉效果与渐变:
- 彩虹: 动画彩虹效果。
- 滑动渐变: 在文本中流动的双色渐变。
- 呼吸渐变: 两种颜色之间的平滑脉冲。
- 静态渐变与纯色: 固定的渐变或传统的纯色文本。
- 颜色: 十六进制代码(如
#RRGGBB)、旧版代码(如 &d)或 Minecraft 颜色名称(如 blue)。
-
自定义背景与边框: 支持纯色、渐变、纹理(拉伸)或纹理(边框/九宫格)模式,并可完全控制透明度。将任意背景图片放入 config/custom-tooltip-api/backgrounds/,并通过动态生成的资源包为每个工具提示启用。完全兼容 Tierify 的自定义渲染。
-
自定义字体: 将任意字体放入 config/custom-tooltip-api/fonts/,并通过动态生成的资源包为每个工具提示启用。
-
位置设定: 精确决定文本出现的位置:
- 顶部: 位于物品名称正下方。
- 底部: 位于所有描述的末尾。
- 前置: 位于特定行的开头。
- 后置: 位于特定行的末尾。
- 替换名称: 用你的自定义文本替换物品的默认名称。
- 替换行: 用你的自定义文本替换特定的一行。
- 替换全部: 完全清除原始工具提示,仅显示你自己的内容。
-
可见性条件: 仅在物品受损、附魔或不可破坏时显示工具提示。使用 Require Keybind 模式,直到玩家按住可配置的按键才显示工具提示。
-
文本修饰符: 完全支持 Bold(加粗)、Italic(斜体)、Underlined(下划线)、Strikethrough(删除线)以及 O̷͍̞͐͑b̷̻̌f̶̯̈u̸̲͗͐s̶̩̬͝c̵͎̊a̸̹̟̎ẗ̴͖̿e̴̟̪͊̈́ď̴̹̪(混淆)文本。
游戏内界面 (GUI)
-
直接从 Mods Menu(模组菜单)管理所有工具提示。除非你愿意,否则无需手动编辑文件。
-
在编辑界面按住 CTRL,即可即时预览你的工具提示。
-
复制/粘贴条目到剪贴板,重新排序、复制、启用/禁用,并按创建日期或字母顺序排序。
面向开发者 (API)
开发者可以使用内置 API,通过代码直接注册工具提示和自定义占位符,并完整支持 .dynamicText(),用于实现每帧更新的实时数据,如能量、法力值或任何自定义 NBT 数据。
面向整合包创作者
该模组会在你的 config 文件夹中生成一个 custom_tooltip_api/config.json5 文件。它完全支持代码注释,使你能够极其轻松地为开发团队或社区记录整合包的系统。
将自定义背景放入 config/custom-tooltip-api/backgrounds/,将自定义字体放入 config/custom-tooltip-api/fonts/。启用动态生成的资源包以激活它们。
依赖项
所有平台必需:
仅限 Fabric:
Custom Tooltip API
Custom Tooltip API is a powerful client-side Minecraft mod and developer library that gives you full control over item tooltips. Add custom lore, dynamic real-time data, animated gradients, and custom backgrounds, all configurable in-game or through code.
No need to code for basic usage, as it features a powerful in-game interface and full JSON support. However, it also provides a robust Developer API for those who want to inject tooltips via code.
Key Features
-
Icon Alignment: Align tooltip icons from external resource packs to the start of the line so the position stays consistent!
-
Advanced Targeting: Target specific item IDs (minecraft:diamond_sword), tag groups (#c:swords), entire mod namespaces (minecraft:*), Regex patterns (regex:.*_sword), or every item at once (*).
-
Dynamic Placeholders: Embed real-time item data directly into your text using variables like %durability%, %max_durability%, %weapon_damage%, or %enchantments%. You can also embed keybind hints using the format <key:key.jump> -> [Space].
-
Multi-line Support (Lore): Add entire paragraphs of lore or skill descriptions.
-
Visual Effects & Gradients:
- Rainbow: Animated rainbow effect.
- Slide Gradient: Two-color gradients that flow through the text.
- Breathing Gradient: A smooth pulse between two colors.
- Static Gradient & Solid: Fixed gradients or traditional solid text.
- Colors: Hex codes (e.g.
#RRGGBB), legacy codes (e.g. &d) or Minecraft color names (e.g. blue).
-
Custom Backgrounds & Borders: Solid, Gradient, Texture (Stretch), or Texture (Framed / Nine-Slice) modes with full opacity control. Drop any background image into config/custom-tooltip-api/backgrounds/ and enable it per tooltip via the dynamically generated resource pack. Supports full compatibility with Tierify custom rendering.
-
Custom Fonts: Drop any font into config/custom-tooltip-api/fonts/ and enable it per tooltip via the dynamically generated resource pack.
-
Positioning: Decide exactly where your text appears:
- Top: Right below the item's name.
- Bottom: At the very end of all descriptions.
- Prepend: At the start of a specific line.
- Append: At the end of a specific line.
- Replace Name: Swap the item's default name for your custom text.
- Replace Line: Replace a specific line with your custom text.
- Replace All: Completely clear the original tooltip and show only yours.
-
Visibility Conditions: Show a tooltip only when an item is Damaged, Enchanted, or Unbreakable. Use Require Keybind mode to hide tooltips until the player holds a configurable key.
-
Text Modifiers: Full support for Bold, Italic, Underlined, Strikethrough, and O̷͍̞͐͑b̷̻̌f̶̯̈u̸̲͗͐s̶̩̬͝c̵͎̊a̸̹̟̎ẗ̴͖̿e̴̟̪͊̈́ď̴̹̪ (obfuscated) text.
In-Game Interface (GUI)
-
Manage all your tooltips directly from the Mods Menu. No need to manually edit files unless you want to.
-
Hold CTRL in the edit screen for an instant Live Preview of your tooltip.
-
Copy/paste entries to clipboard, reorder, duplicate, enable/disable, and sort by creation date or alphabetically.
For Developers (API)
Developers can use the built-in API to register tooltips and custom placeholders directly through code, with full .dynamicText() support for live per-frame data like energy, mana, or any custom NBT.
- Check out the project's README.md file on GitHub!
- A code example can be found here
For Modpack Creators
The mod generates a custom_tooltip_api/config.json5 file in your config folder. It fully supports code comments, making it incredibly easy to document your modpack's systems for your development team or community.
Drop custom backgrounds into config/custom-tooltip-api/backgrounds/ and custom fonts into config/custom-tooltip-api/fonts/. Enable the dynamically generated resource pack to activate them.
Dependencies
Required on all platforms:
Fabric only:
评论 0
登录后参与评分
还没有评论,来抢沙发吧