Appearance
Conditional Patches and You
First off, let's define what this generator is, and does. The primary purpose of this generator is for checking conditions against the elements of the .
This generator has the id defaulted:conditional.
The fields of this generator are as follows:
condition: A patch condition to match against, see here.patch: A data component patch to apply when met.patch_generators: A list of patch generators to apply when met.
Patch Conditions
A patch condition is a condition to match against, with fields added onto the conditional generator depending on which type it is, of the following types:
invert: Inverts the condition in the fieldinverted, like so:json... { ... "condition": "invert", "inverted": { "condition": // Something ... } ... } ...condition_list: Validates the conditions in fieldconditions, requiring all to be true ifall_required, otherwise only requires one to match. This is done like so:json... { ... "condition": "condition_list", "conditions": [ { "condition": // Something ... }, ... ], "all_required": true // Will require all conditions to match if true, matches if any are true if false. ... } ...is_itemoris_enchantment: Validates that the Item/Enchantment is either in a list of items or tag, done like so:json... { ... "condition": "is_item", // Inside of a data component patch, "is_item", otherwise inside of an enchantment patch "is_enchantment" "items": [ // Inside of a data component patch, "items", otherwise inside of an enchantment patch "enchantments", can also be in the form of a single item/enchantment tag "minecraft:totem_of_undying" ] ... } ...in_tag: Validates that the Item or Enchantment is in a list of item/enchantment tags:json... { ... "condition": "in_tag", "tags": [ "minecraft:swords" ] ... } ...has_components: Validates components incomponentsare present, requiring all to be present ifall_required, otherwise only requires one to match. This is done like so:json... { ... "condition": "has_components", "components": [ "minecraft:attribute_modifiers", ... ], "all_required": true // Will require all components present if true, matches if any are true if false. ... } ...matches_components: Validates components incomponentsexactly match, requiring all to match ifall_required, otherwise only requires one to match. This is done like so:json... { ... "condition": "has_components", "components": { "minecraft:enchantable": 15 }, "all_required": true // Will require all components present if true, matches if any are true if false. ... } ...
