https://github.com/mattidragon/jsonpatcher
A fabricmc mod for patching json files with a custom DSL
https://github.com/mattidragon/jsonpatcher
fabricmc programming-language
Last synced: about 1 year ago
JSON representation
A fabricmc mod for patching json files with a custom DSL
- Host: GitHub
- URL: https://github.com/mattidragon/jsonpatcher
- Owner: MattiDragon
- License: mit
- Created: 2023-10-30T14:09:36.000Z (over 2 years ago)
- Default Branch: 1.21.4
- Last Pushed: 2025-03-14T09:14:29.000Z (about 1 year ago)
- Last Synced: 2025-03-14T10:24:52.883Z (about 1 year ago)
- Topics: fabricmc, programming-language
- Language: Java
- Homepage:
- Size: 431 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog/1.1.1+1.21.4.md
- License: LICENSE
Awesome Lists containing this project
README
# JsonPatcher
[](https://modrinth.com/mod/jsonpatcher)
[](https://www.curseforge.com/minecraft/mc-mods/jsonpatcher)
[](https://github.com/MattiDragon/jsonpatcher/issues)
[](https://discord.gg/26T5KK2PBv)
JsonPatcher is a mod that allows you to modify json files in datapacks and resourcepacks without overriding them.
This is primarily useful for mod developers and pack makers, but can also be used by players to modify their own packs.
## Usage
Gradle dependency (for mod developers)
You can add jsonpatcher to your mods buildscript like this:
```groovy
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
modImplementation(include("com.github.mattidragon:jsonpatcher:${jsonpatcher_version}"))
}
```
To begin using jsonpatcher, just create a file with the `.jsonpatch` extension
in the `data//jsonpatcher` directory of your datapack
or `assets//jsonpatcher` directory of your resourcepack.
You'll want to begin your patch with a `@version` meta tag like this.
This will let jsonpatcher know that your patch will work with this version.
In the future you may be able to select a version in more ways.
```
@version "1"
```
Next you'll want to select the files you want to patch.
This is done with the `@target` meta tag. All meta tags follow a json format.
You can either select a single file with a string, use an object for broader selections,
or use an array for multiple selections. If any selector in the array matches, the patch will apply.
Now you can begin modifying the target file. The patch files use a c-like syntax.
You can access the target files contents with `$`. It can be used like a variable,
or you can put the property you want to access directly after it.
For more info on the language, see [the wiki](https://github.com/MattiDragon/JsonPatch/wiki).