Rule#

Rules define the actual logic of each operation your merging can perform. Each rule is defined by a type and then the general configuration of that rule. Rules can do all sorts of things, but generally they apply to a specific path in the file you are editing and then perform some operation on that path via your source.

Important

The target path field will target relative to the intended file you change. For example, when editing a loot table for zombie in the minecraft namespace (minecraft:entities/zombie), editing a path such as pools[0] will target the first pool in the vanilla table, even if a previous pack has prepended a pool to the table. This is because the target path is always relative to the vanilla file.

For welding non-vanilla files, this will be relative to the main namespace, defined by the pack w/o any weld rules set.

type "append" | "prepend" | "insert" | "merge" | "replace" | "remove" -
The type of rule to apply. A weld: can be prefixed on the rule type.

target str - A specifed path to a field within the targeted json file.

conditions list[Condition] (empty) - A list of conditions that must be met for this rule to activate.

priority Priority | None (copied from Main) - A priority definition which specifies the ordering of when this rule should activate.

merge, append, prepend, insert, replace#

source Source - A source definition which specifies the data to append/prepend to the target.

append/prepend#

This rule appends/prepends the defined source to the target location.

Important

Requires the target to be a list.

insert#

index int - The index of the target path.

Important

Requires the target to be a list.

merge#

This rule merges the defined source with the target location. It has three behaviors based on the type of the source and target:

  • Iff both the source and target are lists, all of the source is appended to the target.

  • Iff both the source and target are objects, the source is recursively merged into the target.

  • Otherwise, the source replaces the target.

Note

Since merge performs a recursive merge, nested fields perform the same behaviors as the top-level fields.

replace#

This rule replaces the target location with the defined source.

remove#

This rule removes the target location.