Registry Modifiers

/modifier/

Cold Sweat has a special type of config that allows for the modification of certain other configs. For example, a registry modifier can be used to change the attributes of an insulation item, or to disable a config entirely.

Registry modifiers can target TOML, JSON, and KubeJS registries.

Note: Registry modifiers do not actually modify the target configuration's source. They only modify the data in memory as it is loaded.

Format

{
  // The type of config to target
  // The registry name of each config is given on its respective docs page
  "registry": "cold_sweat:entity/entity_temp",
  // Config formats to check ("toml", "json", "kubejs")
  // Can also be a single element: "config_type": "json"
  "config_type": [
    "json"
  ],
  // List of IDs to check. These IDs are registered by MC when datapacks are parsed
  // Only JSON registries have IDs, so this does not work for TOML or KubeJS configs
  "entries": [
    "cold_sweat:on_fire"
  ],
  // Any configs matching the given data structure(s) are modified
  // These are NBT requirements, so Cold Sweat's special NBT functions also work here
  "matches": [
    {
      "flags": {
        "is_baby": false
      },
      "nbt": {
        "Burning": 1
      }
    },
    {
      // ..more checks
    }
  ],
  // A list of operations to perform on the target's data
  // Explained in the section below
  "operations": [
  ]
}

Operations

Each registry modifier can perform one or many operations on the target config. There are five operation types, each affecting the target data in a different way:

disable

Disables the target entirely, causing it to not load.

replace

Replaces the top-level key of the target, if it exists. The contents of the new data completely replace the old data, which is removed.

merge

Merges the given data with that of the target. If two keys are identical, the new data overwrites the existing data.

If a list of elements is given, the new list will be combined with the old list.

The merge operation also supports performing basic arithmetic on the original value to produce a new value. The following operators are implemented:

  • += Addition

  • -= Subtraction

  • *= Multiplication

  • /= Division

  • ^= Exponent

  • %= Modulus

append

Adds the given data to the target, without overwriting or modifying existing data at all. This operation is "deep", meaning nested data is also appended. This operation does not affect lists.

remove

Removes data from the target. Also supports removing elements from a list.

Last updated