跳到正文

JsonPatcher

作者:MattiDragon

A tool for patching minecrafts json files, without overrding them, using a custom DSL

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

JsonPatcher

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

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.

常见问题

JsonPatcher 支持哪些 Minecraft 版本?

JsonPatcher 支持 Minecraft Java 版 1.20.1–1.21.1,共 6 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。

JsonPatcher 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。

评论

登录后评论和评分

MattiDragon 的其他作品

查看全部 →