Patched 是一个模组,它为数据包/资源包(以及模组!)提供了修改 JSON 文件部分内容的能力,从而避免完全替换这些文件。此模组可用于修补生物群系、战利品表、模型以及游戏中大多数其他 JSON 文件。每当 Mojang 最终使实体模型数据驱动化时(随着每次更新感觉越来越遥远),Patched 也将能够修补它们,提供 OptiFine CEM(自定义实体模型)的轻量级替代方案。
以下是使用 Patched 可以实现的一些不同功能的列表:
- 从生物群系中移除或添加世界生成特性
- 从进度(advancements)中移除或添加标准
- 从战利品表中移除或添加战利品
- 修改合成配方
- 修改匹配特定模式的所有文件(例如,修改所有生物群系)
- 基于已加载的模组或配置选项进行条件修改
- 以及更多功能!
Patched 旨在减少数据包/资源包之间以及其他模组之间的冲突。 它还旨在简化这些文件的维护工作,因为您无需担心文件的其他部分过时(例如,Minecraft 更新可能会修改您正在更改无关部分的生物群系)。
Patched 附带了一些用于检查游戏状态的命令(/patchedc 用于资源包):
/patched list packs显示包含补丁的资源包列表/patched list patches <pack>显示指定资源包提供的补丁列表/patched dump patch <pack> <name>显示指定资源包提供的补丁内容/patched dump file <name>显示文件内容,其中包含注释以指示对文件所做的更改及其作者
工作原理
Patched 允许创建与要修补的文件同名的所谓“补丁”文件。 这些补丁遵循 RFC 6902 的语法,并增加了额外的功能以使其在模组开发环境中更加完善。模组的文档详细介绍了如何编写这些补丁(以及有哪些其他可用功能)。 例如,要从平原生物群系中移除砂砾:
{
"op": "find",
"path": "/features/6",
"test": {
"path": "",
"value": "minecraft:ore_gravel"
},
"then": {
"op": "remove",
"path": ""
}
}
该补丁随后将放置在数据包的 data/minecraft/worldgen/biome 位置,文件名为 plains.json.patch。
为了避免性能问题,Patched 仅查找那些声明包含补丁的资源包中的补丁(即采用主动选择加入机制)。这是为了避免在您整合包中的 200 多个模组中逐一查找,即使其中只有一个实际包含补丁。资源包可以通过在其 pack.mcmeta 中包含以下内容来启用补丁功能:
{
"pack": {
// ...
},
"patched": {
"format_version": 1 // 向 Patched 指示此资源包使用 Patched,因此包含补丁。
}
}
对于模组,此信息可以放置在加载器特定的元数据文件中。 详情请参阅文档。
作为另一个示例,此补丁将一个自定义生物群系添加到“冒险时光”进度中:
[
{
"op": "add",
"path": "/criteria/mydatapack:mybiome",
"value": {
"conditions": {
"player": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"biome": "mydatapack:mybiome"
}
}
}
]
},
"trigger": "minecraft:location"
}
},
{
"op": "add",
"path": "/requirements/-",
"value": [ "mydatapack:mybiome" ]
}
]
兼容性
Patched 挂钩到基础资源加载代码,允许修补 任何 JSON 文件——甚至是其他补丁(理论上)。这将与大多数模组兼容,因为它们无需修改此代码,并且任何使用 Minecraft 资源加载的模组(这几乎是必要条件)都将获得 Patched 的好处。然而,某些模组可能 也 会更改此资源加载代码。在较新版本中,已尝试与此类模组(如果存在)保持兼容,但这同样依赖于它们执行类似的兼容更改。
局限性
不幸的是,一些限制适用于“合并”资源。为澄清起见,合并资源是 Minecraft 在运行时合并的任何资源——最显著的是标签。除了标签之外,还有少数几种此类资源(全部为客户端侧):语言文件、sounds.json、纹理图集源、方块状态和字体。对这些文件施加的限制是,只有提供它们的资源包才能对其进行修补。原因是否则 Patched 不知道补丁应应用于 30 多个文件中的哪一个。
此外,在 1.19.3 之前的版本上,原版生物群系无法(直接)被修补。这是因为在这些版本中,这些生物群系是硬编码的——也就是说,没有文件可供修补。可以通过具有较低优先级的数据包来解决此问题,该数据包从 此处 的世界生成导出中添加生物群系,但我建议升级到 1.19.3 或更高版本。
Patched is a mod that provides the ability for data/resource packs (and mods!) to modify parts of json files, allowing them to avoid outright replacing them. This mod can be used for patching biomes, loot tables, models, and most other json files in the game. Whenever Mojang finally makes entity models data-driven (something that feels more distant with each update), Patched will be able to patch those too, providing a lightweight alternative to OptiFine's CEM (Custom Entity Models).
Here's a list of a few different things one can achieve using Patched:
- Removing or adding world gen features to biomes
- Removing or adding criteria to advancements
- Removing or adding loot to loot tables
- Modifying recipes
- Modifying all files that match a pattern (e.g., modifying all biomes)
- Conditional modifications based on loaded mods or configuration options
- And much more!
Patched is intended to reduce conflicts between data/resource packs as well as between other mods. It's also intended to ease the maintenance of these files, as you don't have to worry about other parts of the file becoming out of date (such as Minecraft updates that modify a biome you're changing an unrelated part of).
Patched comes with a few commands to inspect the state of the game (/patchedc for resource packs):
/patched list packsshows a list of packs that have patches/patched list patches <pack>shows a list of patches provided by a given pack/patched dump patch <pack> <name>shows the contents of the patch provided by a specified pack/patched dump file <name>shows the contents of a file, with comments indicating changes made to the file and by who
How it works
Patched allows creating these so-called "patch" files with the same name as the file being patched. These patches follow the syntax of RFC 6902, with extra features to make it better in a modding context. The mod's documentation details how to write these patches (and what other features are available). For example, to remove gravel from the plains biome:
{
"op": "find",
"path": "/features/6",
"test": {
"path": "",
"value": "minecraft:ore_gravel"
},
"then": {
"op": "remove",
"path": ""
}
}
This patch would then be placed in a data pack at the location data/minecraft/worldgen/biome with the name plains.json.patch.
In order to avoid performance issues, Patched only looks for patches in packs that say they have any (i.e., it's on an opt-in basis). This is to avoid looking in all 200 some mods in your modpack even though only one actually has patches in it. A pack can enable patching by having this in its pack.mcmeta:
{
"pack": {
// ...
},
"patched": {
"format_version": 1 // Indicates to Patched that this pack uses Patched, and therefore contains patches.
}
}
For mods, this information may be placed in the loader-specific metadata file. See the documentation for details.
As another example, this patch adds a custom biome to the "adventuring time" advancement:
[
{
"op": "add",
"path": "/criteria/mydatapack:mybiome",
"value": {
"conditions": {
"player": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"biome": "mydatapack:mybiome"
}
}
}
]
},
"trigger": "minecraft:location"
}
},
{
"op": "add",
"path": "/requirements/-",
"value": [ "mydatapack:mybiome" ]
}
]
Compatibility
Patched hooks into the base resource loading code, allowing any json file to be patched — even other patches (in theory). This will be compatible with the majority of mods, as they will have no need to modify this code, and any mod using Minecraft's resource loading (which is kind of a requirement) will gain the benefits of Patched. However, some mods may also change this resource loading code. In newer versions attempts have been made to be compatible with such mods — should they exist — but this also relies on them to perform similarly compatible changes.
Limitations
Unfortunately, some limitations apply to 'merged' resources. To clarify, a merged resource is any resource that Minecraft merges at runtime — most notably tags. In addition to tags, there are a handful more of these resources (all client-side): language files, sounds.json, texture atlas sources, block states, and fonts. The limitation imposed on these files is that only the pack providing them may patch them. The reason for this is that otherwise Patched doesn't know which of the 30 some files the patch should apply to.
In addition to this, on versions older than 1.19.3, vanilla biomes cannot be (directly) patched. This is because in these versions those biomes are hard-coded — that is, there is no file to patch. This can be worked around by having a data pack with lower priority that adds the biomes from say, the world gen export here, but I would just recommend updating to 1.19.3 or higher.
下载 Patched
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Patched
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
更新日志
- 移植至 26.3
- 修复了在 26.2 中资源重载后,资源包动态补丁失效的问题
- 修复了 Mixin 在 Fabric 26.1 上因 Patched 缺少 refmaps 而报错的问题
变更
- 已更新至 26.1。
- 已撤回对读取旧版 Patched 元数据的支持(该格式自 1.21.1 起已被弃用)。尚未使用
patched { ... }格式的整合包需要更新以采用此格式。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧