Skip to content

Copy Operation

EnderTurret edited this page Nov 5, 2024 · 1 revision

The copy patch type creates a copy of an element and places it somewhere. A similar operation is move, which moves an element elsewhere but does not create a copy.

A copy patch looks like this:

{
  "op": "copy", // specifies this is a copy patch
  "path": "/path/to/destination", // specifies the path to put the copied element
  "from": "/path/to/source/element" // specifies the path to the element to copy
}

For example:

// kill_a_mob.json.patch
{
  "op": "copy",
  "path": "/criteria/moreblazes:enderblaze",
  "from": "/criteria/minecraft:blaze"
}
// kill_a_mob.json (patched)
{
  "criteria": {
    "minecraft:blaze": {
      "conditions": {
        // ...
      },
      "trigger": "minecraft:player_killed_entity"
    },
    "moreblazes:enderblaze": { // copied from /criteria/minecraft:blaze by mod/More Blazes
      "conditions": {
        // ...
      },
      "trigger": "minecraft:player_killed_entity"
    }
  }
}