Skip to content

Latest commit

 

History

History
142 lines (116 loc) · 2.94 KB

BUILTIN.md

File metadata and controls

142 lines (116 loc) · 2.94 KB

Built in predicates

Examples will be shown in JSON format (with comments using //, but you shouldn't copy them). If mod that uses it uses different/incompatible format, check its page for information on how to remap it.

Types:

All true predicate

{
  "type": "all",
  "values": [
    /* List of predicates */
  ]
}

Returns true if all contained predicates have success value of true.

Any true predicate

{
  "type": "any",
  "values": [
    /* List of predicates */
  ]
}

Returns true if at least one contained predicates have success value of true.

Comparison predicate

{
  "type": "equal", // "less_than", "less_or_equal", "more_than" or "more_or_equal"
  // A string (text in quotes), a number or predicate definition
  "value_1": "",
  // Same as "value_1"
  "value_2": ""
}

Checks if value_1 (static or result of predicate) is equal to/less_than/more_than value_2. Depends on type.

Negate predicate

{
  "type": "negate",
  // Predicate definition
  "value": {
    "type": "..."
  }
}

Negates success value of provided predicate.

Operator predicate

{
  "type": "operator",
  // Operator level of player
  "operator": 4
}

Checks if player has required operator level.

Statistic predicate

{
  "type": "statistic",
  // (Optional) Statistic type to check agains (defaults to "minecraft:custom")
  "stat_type": "minecraft:custom",
  // Key of the statistic, an identifier
  "key": ""
}

Checks and returns value of player's statistic with success value of true if it's higher than 0. Should be used with other predicates.

See https://minecraft.fandom.com/wiki/Statistics#Statistic_types_and_names

Entity predicate

{
  "type": "entity",
  // Vanilla predicate definition
  "value": {
    /* More json here */
  }
}

Checks using Vanilla (advancement/loot table) predicates.

See https://minecraft.fandom.com/wiki/Template:Nbt_inherit/conditions/entity

Permission predicate (requires Lucko/Fabric Permission API)

{
  "type": "permission",
  // Permission key required by player
  "permission": "...",
  // (Optional) Alternative operator level (number)
  "operator": 4
}

Checks if player has specified permission.

Permission Option predicate (requires Lucko/Fabric Permission API)

{
  "type": "permission_option",
  // Option key
  "option": "..."
}

Checks if player has specified option set by permission mod. Should be used with others for more specific checks (see Comparator predicates).

Placeholder predicate (requires Text Placeholder API)

{
  "type": "placeholder",
  // Placeholder value with arguments, without `%`
  "placeholder": "...",
  // (Optional) Boolean, making it return raw value (if provides string, it won't be formatted). Defaults to false
  "raw": false
}

Checks if player has specified option set by permission mod. Should be used with others for more specific checks (see Comparator predicates).