Back to mods
JSON Patches lib project artwork

Vintage Story Mod DB · Vintage Story mod

JSON Patches lib

Implements new syntax features for JSON patches. No idea if someone else will want to use it, but I for sure will use it to reduce the amount of time and effort I spend on JSON patches. Feel free to provide feedback and feature requests. If the lib will be p

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which JSON Patches lib release should I use?

Updated 2 days ago
Latest stable file 1.5.6
Game version 1.22.0-pre.1, 1.22.0-pre.2, 1.22.0-pre.3
Loader Built-in Vintage Story mod system

JSON Patches lib 1.5.6 targets 1.22.0-pre.1, 1.22.0-pre.2, 1.22.0-pre.3. It must be installed on the client. Installation on the dedicated server is optional. No extra mods listed for this file.

Where it goes

Is JSON Patches lib required on the client, server, or both?

It must be installed on the client. Installation on the dedicated server is optional.

Client Required
Dedicated server Optional
Loader for this release Built-in Vintage Story mod system
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

This release supports both sides, but the source does not require it on the server.

What else does JSON Patches lib 1.5.6 need?

1.5.6. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add JSON Patches lib without breaking your instance.

Built for JSON Patches lib 1.5.6. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 1.5.6. It targets 1.22.0-pre.1, 1.22.0-pre.2, 1.22.0-pre.3; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    It must be installed on the client. Installation on the dedicated server is optional.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 1.5.6. It opens that exact file at the source.

About this project

What does JSON Patches lib add?

Implements new syntax features for JSON patches.

 

No idea if someone else will want to use it, but I for sure will use it to reduce the amount of time and effort I spend on JSON patches.

Feel free to provide feedback and feature requests. If the lib will be popular, it will have a good change to be integrated into vanilla in 1.23.

 

Documentation:

Patch
[
  {
    "enabled": true, // same as vanilla, if not enabled patch is ignored
    "priority": 0, // all json patches are applied in the order from highest to lowest priority, default is 0, use it to patch other patches by setting higher priority
    "op": "add", // operation, not case-sensitive, same as vanilla json patches, possible values: "Add", "AddEach", "AddMerge", "Replace", "Remove", "Copy", "Move", "Expression"
    "file": "game:itemtypes/snowball", // asset location of json file you want to patch, supports wildcard and regexes, to use wildcards add `@` in the beginning of the path, to use regexes add `@@`, the path is matched as whole with domain in these cases
    "path": "attributes/shelvable", // path inside json, like vanilla, but with additional features:
    // - wildcard support: "texturesByType/@@snowball-*/normal2"
    // - regex support: "texturesByType/@@@snowball-(snow|beenade)/normal2"
    // - property matching: "variantgroups/code=rock/states"
    // - range matching: "variantgroups/0-2/states/0-1"
    // - index matching: "variantgroups/0/states/1"
    // - all indexes matching: "variantgroups/-/states/-"
    // Each type of matching is applied inside a single path element (path between two closest '/')
    "fromPath": "attributes/shelvable", // same as 'path'
    "side": "universal", // same as vanilla, side where patch will be applied, possible values: "client", "server", "universal"
    "value": 0, // same as vanilla, used to add or replace a value, unlike vanilla can be used with 'remove' operation to match and element to remove (supports wildcards and regexes via '@@' and '@@@' prefixes)
    "dependsOn": [{"modId": "game", "invert": false}], // same as vanilla, used to enable/disable patch based on which mods are loaded
  } // unlike vanilla patches do not support 'conditions', that are meant to be used with world config
]

Put patches into 'jsonpatches' folder, same as vanilla patches are put into 'patches' folder. Patches from this library are applied before vanilla patches, so you can patch vanilla patches. Patches from this lib can have priority specified, that allows to patch them (just specify priority higher than of the patch you want to patch).

 

Examples:

#1
[
  {"enabled": true, "file": "game:config/traits", "op": "replace", "path": "/code=soldier/attributes/armorWalkSpeedAffectedness", "value": -0.5},
  {"enabled": true, "file": "game:config/traits", "op": "addmerge", "path": "/code=soldier/attributes", "value": {"armorManipulationSpeedAffectedness": -0.5}},
  {"enabled": true, "file": "game:config/traits", "op": "addmerge", "path": "/code=soldier/attributes", "value": {"armorHungerRateAffectedness": -0.5}},
  {"enabled": true, "file": "game:config/traits", "op": "remove", "path": "/code=soldier/attributes/meleeWeaponsDamage"},
  {"enabled": true, "file": "game:config/characterclasses", "op": "remove", "path": "/code=blackguard/traits/-", "value": "nearsighted"},
  {
    "enabled": true,
    "file": "game:config/characterclasses",
    "op": "addeach",
    "path": "/code=blackguard/traits/-",
    "value": ["meleeExpert", "oneHandedSwordsProficiency", "twoHandedSwordsProficiency", "poleaxeProficiency", "tremblingAim", "clumsyHands", "canParryProjectiles", "legDay"]
  }
]
#2
[
  {
    "enabled": true,
    "side": "server",
    "op": "add",
    "file": "@game:itemtypes/toolhead/*.json",
    "path": "creativeinventory/jsonpatches",
    "value": []
  },
  {
    "enabled": true,
    "side": "server",
    "op": "addeach",
    "file": "@@game:itemtypes/toolhead/.+.json",
    "path": "creativeinventory/jsonpatches/-",
    "value": ["*-gold", "*-silver"]
  },
  {
    "enabled": true,
    "side": "server",
    "op": "addmerge",
    "file": "@game:itemtypes/*/arrowhead.json",
    "path": "creativeinventory/jsonpatches",
    "value": ["*-copper", "*-iron", "*-steel"]
  },
  {
    "enabled": true,
    "side": "server",
    "op": "add",
    "file": "game:itemtypes/toolhead/arrowhead.json",
    "path": "creativeinventory/temp",
    "value": []
  },
  {
    "enabled": true,
    "side": "server",
    "op": "copy",
    "file": "game:itemtypes/toolhead/arrowhead.json",
    "frompath": "creativeinventory/jsonpatches/4",
    "path": "creativeinventory/temp/-"
  },
  {
    "enabled": true,
    "side": "server",
    "op": "move",
    "file": "game:itemtypes/toolhead/arrowhead.json",
    "frompath": "creativeinventory/jsonpatches/3",
    "path": "creativeinventory/temp/-"
  },
  {
    "enabled": true,
    "side": "server",
    "op": "move",
    "file": "game:itemtypes/toolhead/arrowhead.json",
    "frompath": "creativeinventory/jsonpatches/2",
    "path": "creativeinventory/temp/-"
  },
  {
    "enabled": true,
    "side": "server",
    "op": "move",
    "file": "game:itemtypes/toolhead/arrowhead.json",
    "frompath": "creativeinventory/temp/1",
    "path": "creativeinventory/jsonpatches/-"
  },
  {
    "enabled": true,
    "side": "server",
    "op": "remove",
    "file": "@game:itemtypes/*/arrowhead.json",
    "path": "creativeinventory/jsonpatches/-",
    "value": "*-steel"
  }
]
#3
[
  {"op": "add", "side": "server", "file": "@@game:itemtypes/tool/(axe-metal|blade|spear)", "path": "/skipVariants/-", "value": "*-ruined"},
  {"op": "remove", "side": "server", "file": "@@game:itemtypes/tool/(axe-metal|blade|club|spear)", "path": "/allowedVariants/-", "value": "@@*-ruined"},
  {"op": "expression", "file": "@game:itemtypes/*/arrowhead.json", "path": "maxstacksize", "value": "value / 8 * 3 + 2"}
]

Project description from Vintage Story Mod DB.

Pick your setup

JSON Patches lib releases for each Vintage Story version.

Choose the version and loader you play, then open the matching release.

44 available setups

Showing the newest 12 of 44 game versions. Older files are in the list below.

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

JSON Patches lib versions and loaders

18 of 18 releases match

Looking for an older file? The official Vintage Story Mod DB project page is in Resources.