All Mods Resource Packs Data Packs Shaders Modpacks Plugins
JsonPatcher

JsonPatcher

by MattiDragon • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

JsonPatcher

Badge showing the amount of downloads on modrinth Badge showing the amount of downloads on curseforge Badge linking to issues on github

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.

V2 Disclaimer

JsonPatcher v2 is currently in beta. V2 introduces a bunch of new features including global patches for mods and modpacks. Documentation for v2 is available at jsonpatcher-docs.mattidragon.dev. The documentation is however quite incomplete and partially outdated. For some cases it might be best to consult the old wiki instead.

Usage

Gradle dependency (for mod developers)

You can add jsonpatcher to your mods buildscript like this:

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/<namespace>/jsonpatch directory of your datapack or assets/<namespace>/jsonpatch 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.

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21
Fabric Quilt
last yr. 1
1.20.6
Fabric Quilt
last yr. 1
1.20.2
Fabric Quilt
last yr. 1
1.20.1
Fabric Quilt
last yr. 1
1.20.4
Fabric Quilt
last yr. 1
1.20.x
Fabric Quilt
last yr. 1
1.20.1
Fabric Quilt
last yr. 1
1.20.1
Fabric Quilt
last yr. 1
1.20.1
Fabric Quilt
last yr. 1
  • Fixed issue where JsonPatcher would fail to set up its data directories
  • Updated language to beta 8
  • Fixed various minor issues
  • Rerelease of beta 5 in order to fix jitpack deployment
  • Updated language to beta 7, with bugfixes and improvements
  • Added metapatch.searchFiles for looking up all files in a directory
  • Added jsonpatcher-workspace.json files to folder setup
  • Fixed a bug where certain patch targets are never checked
  • Added and updated docs for built-in code (metapatch and metadata tags)
  • The jsonpatcher:text library is once again available
  • Fixed crash when loading global patches
  • Minor tweaks to generated class names to reduce crashing
  • When throw_on_failure is enabled, global patches now crash the game on failure
  • Errors in global scripts now show up in the jsonpatcher log
  • The main log now only gets a summary
  • Updated lang module to beta 3
  • Fixed issues with resolving inner classes in reflection
  • Implemented loading of resource patches from global directory
  • Cleanup of dumping locations
  • Expose compiler error nicer
  • Properly JiJ lang library
  • Docs are now emitted upon startup
  • Fixes to global patches
  • Files not ending in .jsonpatch are no longer loaded
  • Errors are now emitted to jsonpatcher logs, similarly to data patches
  • Entrypoints are now correctly loaded from the @init meta tag
First beta of v2. This release has overhauled large parts of the language and not everything can be listed here.

Some highlights:
  • Replaced tree-walking interpreter with compiler for jvm bytecode
  • Noticeable performance uplift
  • Expanded standard library
  • Minor changes everywhere
  • More of the stdlib is now written in jsonpatcher code
  • Add reflection library for accessing java code
  • Locked by default to patches from mods and modpacks
  • Allows for more to be done in jsonpatcher without having to write wrappers in java
  • Global patch system for libraries and startup patches for mods and modpacks
  • Due to design limitations, metapatches now use a library instead of a global

Lots of improvements have also been done to tooling and the language server,
but they will mostly be released at a later time.
[1.1.1+mc.1.21.1] v1.1.1 [1.21.1] by MattiDragon on Oct 31, 2024
Download
  • Fix issue with sided mixin files
[1.1.0+mc.1.21.1] v1.1.0 [1.21.1] by MattiDragon on Aug 10, 2024
Download
  • Updated to 1.21.1
[1.1.0+mc.1.21] v1.1.0 [1.21] by MattiDragon on Jun 28, 2024
Download
  • Updated to 1.21
  • Use an alternative hook point in order
  • Provides better compatibility with mods reading resources outside of reloads
  • Only loads patches once per pack load
  • No longer warns when a file isn't being patched (most such cases should have been fixed anyway)
  • Renamed abort_reload_on_failure to throw_on_failure to better reflect its behaviour
  • Update language library
  • Made debug library functions that throw errors slightly cleaner
  • Added default arguments (no named arguments yet)
  • Added varargs support
  • Added objects library
  • Replaced arrays.mapped and arrays.filtered with arrays.replace and arrays.removeIf respectively
  • Added various other library functions
  • Cleaned up stack traces
  • Improved many error messages
  • Added option for metapatches to filter files using targets
  • There's now a [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=MattiDragon.jsonpatcher) available!
[1.0.0+mc.1.20.6] v1.0.0 [1.20.6] by MattiDragon on May 12, 2024
Download
  • Updated to 1.20.6
  • Patching is now injected slightly differently to account for the new known pack syncing
and other changes to resource loading
  • Fixed incompatibility with EBE by moving mixin injection earlier
  • Fixed incompatibility with EBE by moving mixin injection earlier
  • Fixed incompatibility with EBE by moving mixin injection earlier
  • Updated to 1.20.2
  • Fixed capitalisation of metapatch library
  • Moved core language to its own project
  • Added ternary operator
  • Added option to dump patched files
  • Added metapatches
  • They are patches that don't change a file, but instead add or remove existing files
  • Added priority system for patches
  • Updated language
  • Meta tags can now be empty, will be interpreted as null
  • String keys are now supported in objects
  • Support negative numbers in meta tags
Initial release on modrinth
JsonPatcher Icon
Download JsonPatcher
Select game version
Select platform