TipTool
Minecraft 1.12.2 CraftTweaker addon to simplify adding translated item tooltips with standardised formatting to many items, intended for use in modpacks
介绍
TipTool
Minecraft 1.12.2 CraftTweaker addon to simplify adding translated item tooltips with standardised formatting to many items, intended for use in modpacks.
Instructions:
First, define tooltip sections and their formatting with
import mods.tiptool.TipTool;
val section = TipTool.registerTooltipSection("sectionKey");
section.aqua(); # Any of the formatting options from format.*
section.header(
format.red(section.translate('header')), # lang key prefixed with 'tiptool.sectionKey.tooltip.'
2 # optional indent level (as number of spaces) automatically applied to body underneath the header
);
Then, enable automatic tooltipping on items
# will use lang keys 'tiptool.iron_ingot.tooltip.sectionKey' for each section,
# OR 'tiptool.iron_ingot.tooltip.sectionKey.1' - 'tiptool.iron_ingot.tooltip.sectionKey.n' for multiline sections
<minecraft:iron_ingot>.automateTooltips()
# All variants of stone will receive the same tooltips from 'tiptool.iron_ingot.tooltip.sectionKey'
<minecraft:stone>.automateTooltips()
# Only regular stone will receive the tooltips from 'tiptool.iron_ingot.tooltip.sectionKey'
<minecraft:stone:0>.automateTooltips()
# specify an explicit language key if you want to use different tooltips for different variants
# this will use language keys 'tiptool.variantLangKey.sectionKey' for each section
<minecraft:stone:1>.automateTooltips("variantLangKey")
# A more likely example for variants
val woolDefinition = <minecraft:wool>.definition;
for i in 0 to 15 {
woolDefinition.makeStack(i).automateTooltips("minecraft:wool:" + i);
}
Defining translations
You can define translations in regular lang files, but that can become cumbersome quickly. Instead, you can use the TipTool.registerLangFiles(path) method to register a set of .yml lang files to be loaded specifically for tooltips. The path is relative to the scripts/ directory.
# scripts/some_zs.zs
mods.tiptool.TipTool.registerLangFiles("path/tooltip")
# scripts/path/tooltip/en_us.yml
minecraft:iron_ingot:
sectionKey: translation for the "sectionKey" section of minecraft:iron_ingot's tooltip
multilineSection: |
Multiple lines will be split up into separate lang keys automatically
minecraft:iron_ingot will have multiple lines of translated tooltips for this section
Under the hood, the lang keys used are:
- tiptool.minecraft:iron_ingot.tooltip.multilineSection.1
- tiptool.minecraft:iron_ingot.tooltip.multilineSection.2
- etc.
You can mix single- and multi-line tooltips for the same section on different items.
minecraft:stone:1:
multilineSection: sections themselves don't care if you use a single line or multiple
sectionKey:
key: translation for text created with `registerTooltipSection("sectionKey").translate("key")`
header: This matches up with the `section.translate('header')` in the header example above
常见问题
TipTool 支持哪些 Minecraft 版本?
TipTool 支持 Minecraft Java 版 1.12.2,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。
TipTool 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
评论
登录后评论和评分