介绍
HPTlib
HPTlib 是我的匠魂(Tinkers’ Construct)附属模组共用的前置库,单独安装没有新内容。它提供两部分功能:
材料三围与属性公式
原版匠魂里,每个材料都要为每种属性类型手写一份数值。新加一种部件属性类型,就得给所有材料各补一份。HPTlib 换成了另一种做法:
- 材料三围:给材料填硬度、密度、韧性三项数值,也支持自定义数值。
- 属性公式:给某个属性类型写一份线性公式。所有填了三围的材料会自动算出这个类型的数值和特性。100 个材料只需要 1 份公式。
- 部件公式:按部件所用材料的三围,给工具额外加成属性和特性。匠魂原版部件也能写。
- 灵活覆盖:材料里手写的字段优先,也可以排除某些属性类型;替换模式下完全只用公式的结果。
- 提示框:部件提示框会直接显示加成,按住 Shift 查看属性,F3+H 查看原值和加成。
整套功能只靠数据包驱动,生成的都是普通的匠魂材料数据,手册、JEI 和联机同步都照常工作。用 KubeJS 写的话,请配合 Tinkers KubeJS Arsenal 使用。
通用结构定位强化
为各个附属提供统一的“结构定位”能力强化和升级配方。附属只需要把自己的定位眼睛加入物品标签并注册对应的结构,就能共用同一个词条。末影之眼已经内置,可以定位要塞。
HPTlib
HPTlib is a shared library for my Tinkers’ Construct addons. It adds no content on its own. It provides two features:
Material properties and stat formulas
In Tinkers’ Construct, every material needs hand-written stats for every stat type, so adding a new stat type means writing data for every material. HPTlib offers another way:
- Material properties: give a material hardness, density and toughness. Custom values are supported.
- Stat formulas: write one linear formula for a stat type, and every material with properties gets its stats and traits generated. 100 materials need just 1 formula.
- Part formulas: add extra tool stats and traits based on the properties of each part’s material. Tinkers’ own parts are supported.
- Flexible overrides: hand-written fields win, stat types can be excluded, and replace mode uses only the formula results.
- Tooltips: part tooltips show the bonus. Hold Shift for stats, and use F3+H to see the original value and the bonus.
Everything is driven by data packs and produces normal Tinkers material data, so the book, JEI and multiplayer sync all work as usual. For KubeJS, use Tinkers KubeJS Arsenal.
Shared structure locating modifier
A shared “structure locating” ability modifier and upgrade recipe for addons. An addon only needs to add its locating eye to an item tag and register the matching structure to use the same modifier. The Eye of Ender is built in and locates strongholds.
数据包写法 / Data pack format
系数写法 / Coefficients
公式里的每个数值都用同一种对象表示,结果 = base + Σ(倍率 × 三围)。
Every value in a formula uses the same object: result = base + Σ(coefficient × property).
| 键 / Key | 含义 / Meaning |
|---|---|
hardness、density、toughness、自定义键 / custom keys |
对应三围的倍率 / Coefficient of that property |
base |
常数项 / Constant |
min、max |
限制结果范围 / Clamp the result |
round |
none、nearest、floor、ceil(整数字段用 nearest / use nearest for integer fields) |
例如 / Example:{ "base": 100, "toughness": 50 } = 100 + 50 × 韧性 / toughness
1. 材料三围 / Material properties
data/<命名空间>/tinkering/materials/stats/<材料>.json
写在匠魂材料属性文件的 properties 字段,只写 properties 也可以。多个数据包按优先级逐键合并,给已有材料加三围不会覆盖它原有的属性。
Goes in the properties field of the Tinkers material stats file; a file may contain only properties. Files from several data packs are merged key by key, so adding properties to an existing material keeps its stats.
{
"properties": {
"hardness": 4,
"density": 5,
"toughness": 9,
"exclude": ["tconstruct:limb"],
"replace": false
}
}
exclude:这些属性类型不按公式生成 / Stat types not generated from formulasreplace:为true时丢弃手写属性,只用公式结果 / Iftrue, hand-written stats are dropped and only formula results are used
2. 属性公式 / Stat formulas
data/<命名空间>/tinkering/stat_formulas/<属性类型>.json,例如 / e.g. data/tconstruct/tinkering/stat_formulas/head.json
{
"fields": {
"melee_attack": { "hardness": 1 },
"durability": { "base": 100, "toughness": 50, "round": "nearest", "min": 1 },
"mining_speed": { "base": 2, "hardness": 0.5, "density": -0.2, "min": 1 },
"mining_tier": {
"score": { "hardness": 1 },
"levels": [[0, "minecraft:wood"], [3, "minecraft:stone"], [6, "minecraft:iron"], [9, "minecraft:diamond"]]
}
},
"traits": [
{ "modifier": "tconstruct:reinforced", "level": { "toughness": 0.25 }, "max": 5 }
]
}
三围 4 / 5 / 9 的材料算出 / A material with 4 / 5 / 9 gets:攻击 / attack 4,耐久 / durability 550,挖掘速度 / mining speed 3,挖掘等级 / tier stone,强化 / Reinforced II。
levels:先用score算分数,取不超过分数的最高一档 / Pick the highest level not above the scoretraits:等级向下取整,小于 1 不添加;与材料已有的同名特性等级相加 / Level is rounded down, skipped below 1, and added to the same existing trait
3. 部件公式 / Part formulas
data/<命名空间>/tinkering/part_formulas/<部件>.json,例如 / e.g. data/tconstruct/tinkering/part_formulas/pick_head.json
{
"stats": [
{ "stat": "tconstruct:attack_damage", "op": "add", "value": { "hardness": 0.5 } },
{ "stat": "tconstruct:mining_speed", "op": "percent", "value": { "density": -0.02, "min": -0.5 } }
],
"traits": [
{ "modifier": "tconstruct:lustrous", "level": { "hardness": 0.2 }, "max": 2 }
]
}
op:base、add、percent、multiply,结果会乘上部件倍率 / The result is multiplied by the part scale- 部件材料没有三围时不加成 / No bonus when the part material has no properties
- 公式文件同一路径整份覆盖 / Formula files with the same path replace each other as a whole
常见问题
HPTlib 支持哪些 Minecraft 版本?
HPTlib 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。
HPTlib 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
hp12138 的其他作品
查看全部 →Thunder Relics
新增雷霆之王 Boss、富有动感的皇家长戟战斗、风暴仪式,以及一整套皇家盔甲。
gatewaysjs
这是 GatewaysToEternity 模组的 KubeJS 附属模组,提供事件集成和 API,方便自定义 Minecraft 中的传送门玩法。
tetrawhetstone
加快 Tetra 工具磨砺进度。
FTB Quest Enhance
增强 FTB Quests 的编辑功能,支持从剪贴板粘贴图片、在章节画布上添加文字,以及在任务和击杀任务中预览实体模型。
评论
登录后评论和评分