Modding:JSON Patching: Difference between revisions

From Vintage Story Wiki
Normalizing all snippets to use shorthand property names, to avoid confusion; fixing JSON error in example
m (Changing all "json" syntax highlighting to "yaml")
(Normalizing all snippets to use shorthand property names, to avoid confusion; fixing JSON error in example)
Line 130: Line 130:
If you know that a target JSON file is only applied on the server or client, you can use the attribute "side" with the appropriate value to avoid unnecessary processing and the accompanying warnings in log files such as "''Hint: This asset is usually only loaded Server side''". For example, a cooking recipe will only be loaded by the server and you could therefore add the attribute :
If you know that a target JSON file is only applied on the server or client, you can use the attribute "side" with the appropriate value to avoid unnecessary processing and the accompanying warnings in log files such as "''Hint: This asset is usually only loaded Server side''". For example, a cooking recipe will only be loaded by the server and you could therefore add the attribute :
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
"side": "server"
side: "server"
</syntaxhighlight>
</syntaxhighlight>
so the client doesn't try to patch anything.
so the client doesn't try to patch anything.
Line 162: Line 162:
[
[
   {
   {
     "op": "add",
     op: "add",
     "path": "/behaviors",
     path: "/behaviors",
     "value": [{ "name": "SealPlacedCrock" }],
     value: [{ name: "SealPlacedCrock" }],
     "file": "game:itemtypes/resource/fat.json"
     file: "game:itemtypes/resource/fat.json"
   }
   }
]
]
Line 181: Line 181:
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
# Result of bad patch on 1.19.4
# Result of bad patch on 1.19.4
         behaviors: [{ "name": "SealPlacedCrock" }],
         behaviors: [{ name: "SealPlacedCrock" }],
</syntaxhighlight>
</syntaxhighlight>


Line 189: Line 189:
[
[
   {
   {
     "op": "addmerge",
     op: "addmerge",
     "path": "/behaviors",
     path: "/behaviors",
     "value": [{ "name": "SealPlacedCrock" }],
     value: [{ name: "SealPlacedCrock" }],
     "file": "game:itemtypes/resource/fat.json"
     file: "game:itemtypes/resource/fat.json"
   }
   }
]
]
Line 201: Line 201:
# Result of good patch on 1.19.4
# Result of good patch on 1.19.4
         behaviors: [
         behaviors: [
                 { name: "GroundStorable", properties: { layout: 'Quadrants', collisionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.125, z2: 1 }, scale: 0.3 } }
                 { name: "GroundStorable", properties: { layout: 'Quadrants', collisionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.125, z2: 1 }, scale: 0.3 } },
                { name: "SealPlacedCrock" }
         ],
         ],
        behaviors: [{ "name": "SealPlacedCrock" }],
</syntaxhighlight>
</syntaxhighlight>


Confirmedusers
7

edits