截图
介绍
介绍由机器翻译自 Modrinth 原页面,仅供参考。
Variants-CIT
一种专为处理大量变体而设计的替代 CIT 格式。
当同一物品拥有许多基于相同数据片段的变体时,这个模组能够发挥出色的效果。在拥有极大量 CIT 的情况下,它可以提供更好的性能,并采用冗余更少的资源格式,只需一个简短文件即可一次性配置某个物品的所有可能变体。
仍然可以像 Optifine-CIT 那样,逐个为变体指定模型,但这样无法获得同等的性能。
资源包格式
这是一个快速展示。如需完整指南,请参阅 Wiki。
该格式的核心是将物品变体自动关联到名称匹配的模型或纹理。
你无需为每个变体分别定义条件,而是为一个集合中的所有变体定义一条统一规则(称为模块)。该模块会定义受影响的物品、确定其变体的方式,以及变体模型所在的位置。
完全自动的变体到模型关联
下面是一个会改变附魔书纹理的简单模块:
{
"items": "enchanted_book", // The affected item type(s)
"modelPrefix": "book_cit/", // The folder containing the possible models/textures.
"assetGen": "item_model/generated", // Auto-generate models from textures (if missing)
"type": "stored_entchantment", // How to compute the item's "variant ID"
"parameters": { // Extra options specific to the module's type
"levelSeparator": "_lvl_" // Include enchantment level in the variant ID
}
}
在这里,一本带有 minecraft:unbreaking II 级附魔的书,其变体 ID 将为 minecraft:unbreaking_lvl_2,因此会使用存储在 /assets/minecraft/textures/item/book_cit/unbreaking_lvl_2.png 的纹理。
只要存在对应的纹理,这个模块就能适用于所有可能的附魔,无论是原版附魔还是模组添加的附魔。
基于自定义数据的自动变体
上面的模块为附魔书提供了专用类型。如果某种特定用途没有对应的类型,你仍然可以使用更通用的模块,从任意组件中获取变体:
{
"items": "minecraft:suspicious_stew",
"modelPrefix": "item/suspicious_stew_cit/",
"assetGen": "item_model/generated",
"type": "component_data",
"parameters": {
"componentType": "suspicious_stew_effects", // The component containing the variant ID
"nbtPath": "[0].id" // The location of the variant ID in the component.
}
}
处理无法直接使用的数据:
{
"items": "diamond_sword",
"modelPrefix": "item/named_swords/",
"assetGen": "item_model/handheld",
"type": "component_data",
"parameters":
{
"componentType": "custom_name",
"transform": [
{
"function": "regex",
// 模式匹配,……
"regex": "(?i)(.*'s )?(Great |Grand )?(?<var>.*(sword|dagger))( of doom)?",
// ……并且只保留名称的一部分。
"substitution": "$var"
// (例如:"steev18's great Steel Sword" => "Steel Sword")
}
{
// 将任意文本转换为有效的标识符
"function": "sanitize"
// (例如:"Steel Sword" => "minecraft:steel_sword")
}
]
}
}
组合来自不同来源的多份数据:
{
"items": "minecraft:diamond_sword",
"modelPrefix": "item/trimmed_diamond_sword/",
"assetGen": "item_model/handheld",
"type": "component_format",
"parameters":
{
// 如何将多份数据组合成一个变体 ID
// (例如:sentry_diamond)
"format": "${pattern}_${material}",
// 从哪里找到这些数据。
"variables": {
"pattern": {
"componentType": "trim",
"nbtPath": ".pattern"
},
"material": {
"componentType": "trim",
"nbtPath": ".material",
"transform": "discard_namespace"
}
}
}
}
逐变体
对于并不真正遵循任何规则的系统(或者你的变体太少,不值得考虑自动化),你可以使用更接近 Optifine-CIT 范式的格式:
{
"items": "trident",
"modelPrefix": "item/godly_tridents/",
"assetGen": "item_model/trident",
"type": "predicates",
"parameters": {
"predicates":
[
{
"variantId": "zeus_smite",
"precondition": {
"enchantments.channeling": { "greater_or_equals": 1 }
}
},
{
"variantId": "jupiter_syphon",
"precondition": {
"enchantments.riptide": { "greater_or_equals": 1 }
}
}
// 等等
]
}
}
评论
登录后评论和评分