Variants-CIT
一种旨在处理大量变体的 CIT 格式。
该模组在以下场景中表现出色:单个物品拥有许多基于相同数据片段的变体。当存在极大量的 CIT 时,它能提供更好的性能,并使用冗余度较低的资源格式,仅需一个简短的文件即可一次性配置物品的所有可能变体。
虽然仍可以逐个案例地分配模型(类似于 Optifine-CIT 的处理方式),但其性能并不如自动关联那样出色。
资源包格式
此处为快速展示。完整指南请参阅 Wiki。
该格式的核心在于将物品变体与名称匹配的模型或纹理自动关联。 与其为每个变体定义单独的条件,不如定义一条控制整个集合中所有变体的单一规则(即所谓的 模块)。该模块定义了受影响的物品、如何确定其变体以及变体模型的位置。
完全自动的变体到模型关联
这是一个简单的模块,用于更改附魔书的纹理:
{
"items": "enchanted_book", // 受影响的物品类型
"modelPrefix": "book_cit/", // 包含可能模型/纹理的文件夹。
"assetGen": "item_model/generated", // 从纹理自动生成模型(如果缺失)
"type": "stored_entchantment", // 如何计算物品的“变体 ID”
"parameters": { // 模块类型特有的额外选项
"levelSeparator": "_lvl_" // 在变体 ID 中包含附魔等级
}
}
在此例中,具有 minecraft:unbreaking 附魔且等级为 2 的书将拥有变体 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", // 包含变体 ID 的组件
"nbtPath": "[0].id" // 变体 ID 在组件中的位置。
}
}
处理无法直接使用的数据:
{
"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 }
}
}
// 等等
]
}
}
Variants-CIT
An alternative CIT format designed to handle large amounts of variants.
This mod excels in scenarios where one item has many variants all based on the same pieces of data. It yields better performances when extreme amounts of CITs are available, and uses a resource format that is less redundant, requiring only one short file to configure all possible variants of an item at once.
Assigning models on a case-by-case basis (similar to how Optifine-CIT handles it) is still possible, but does not boast the same performances.
Resource Pack Format
This is a quick showcase. Refer to The Wiki for a complete guide.
The format revolves around item variants being automatically associated to models or textures with matching names. Instead of defining separate conditions for every variants, you define a single rule that governs all variants in a collection, (so-called modules). This module defines what item is affected, how to figure out its variants, and where the variant models are located.
Fully automatic variants-to-model association
Here's a simple module that would change the texture of enchanted books :
{
"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
}
}
Here, a book with the enchantment minecraft:unbreaking at level 2 will have the variant ID minecraft:unbreaking_lvl_2, and thus use the texture stored at /assets/minecraft/textures/item/book_cit/unbreaking_lvl_2.png.
This single module will work for every possible enchantment, vanilla or modded, so long as a corresponding texture exists.
Automatic variants based on custom data
The module above has a purpose-made type for enchanted books. If no type exists for a specific use-case, you can still use more generic modules to get a variant from any component:
{
"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.
}
}
Processing data that can't be used as-is:
{
"items": "diamond_sword",
"modelPrefix": "item/named_swords/",
"assetGen": "item_model/handheld",
"type": "component_data",
"parameters":
{
"componentType": "custom_name",
"transform": [
{
"function": "regex",
// Pattern matching,..
"regex": "(?i)(.*'s )?(Great |Grand )?(?<var>.*(sword|dagger))( of doom)?",
// ... and preserve only a portion of the name.
"substitution": "$var"
// (E.g: "steev18's great Steel Sword" => "Steel Sword")
}
{
// Turns any text into a valid identifier
"function": "sanitize"
// (E.g: "Steel Sword" => "minecraft:steel_sword")
}
]
}
}
Combining multiple pieces of data from different sources:
{
"items": "minecraft:diamond_sword",
"modelPrefix": "item/trimmed_diamond_sword/",
"assetGen": "item_model/handheld",
"type": "component_format",
"parameters":
{
// How to combine various pieces of data into a variant ID
// (E.g: sentry_diamond)
"format": "${pattern}_${material}",
// Where to find those pieces of data.
"variables": {
"pattern": {
"componentType": "trim",
"nbtPath": ".pattern"
},
"material": {
"componentType": "trim",
"nbtPath": ".material",
"transform": "discard_namespace"
}
}
}
}
Case-by-case variants
For systems that don't really follow any rules, (or if you have too few variants to care about automatism), you can use a format closer to Optifine-CIT's paradigms:
{
"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 }
}
}
// etc
]
}
}
下载 Variants-CIT
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Variants-CIT
下载 Variants-CIT
下载 Variants-CIT
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Variants-CIT
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- 修复了一些神秘的初始化问题
- 修复了
equipment/horseassetGen 预设中的错误。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
缓冲的原始输入和线程化的事件轮询
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
原版世界生成优化模组
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
评论 0
登录后参与评分
还没有评论,来抢沙发吧