Compatibility
Minecraft: Java Edition
Platforms
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Links
Creators
Details
Patched is a mod that provides the ability to modify parts of json files for data/resource packs to use. It can be used for patching biomes, loot tables, models, and most other json files in the game. Whenever Mojang makes entity models data-driven, Patched will likely be able to patch those too, allowing for a basic alternative to OptiFine's CEM.
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
- 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 also comes with a few commands to inspect the state of the game (/patchedc
for client-side):
/patched list packs
shows 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 patch syntax is documented here and there is a guide to authoring patches here. For example, to remove gravel from plains biomes:
{
"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.
}
}
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, which will cause at best lack of functionality and at worst crashes.
Limitations
Unfortunately, there are some kinds of json files that cannot be patched. Currently, that would be tags and lang files (and maybe atlases?), which is because of how Minecraft loads them from each pack to merge them. Patched cannot easily apply patches to these files because it wouldn't now which of the 30 or so are to be patched. Any resource types that are similarly aggregated will suffer from the same problem.
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 prior data pack add the biomes from say, the world gen export here, but I would just recommend updating to 1.19.3.