Language

Data Criteria

Data Criteria

Modrinth

Data-driven advancement criteria

1.8k downloads 5 followers updated 35mo ago
latest v1.0.1+1.20 Modrinth
Fabric Quilt 1.18.2 – 1.20.1 Library

Why?

Check out this page for an example of creating advancement criteria without this mod. See the rest of the wiki for complete documentation.

Example

1 - Create a criterion file. parameters is an ordered list of parameter names and types to pass in and check for. Make sure to group optional parameters at the end.

data/namespace/criteria/int_and_bool.json

{
  "parameters": [
    {
      "name": "number",
      "type": "datacriteria:int"
    },
    {
      "name": "possible",
      "type": "datacriteria:bool",
      "optional": true
    }
  ]
}

2 - Use the criterion within an advancement file.

{
  // ...
  "criteria": {
    "test": {
      "trigger": "namespace:int_and_bool",
      "conditions": {
        "number": 5,
        // As 'possible' is optional, it's not required in the conditions
      }
    }
  }
  // ...
}

3 - Trigger the criterion through DataCriteriaAPI.

DataCriteriaAPI.trigger(
    new Identifier("namespace:int_and_bool"),
    serverPlayer,
    // The parameters begin here
    10, true
);

License

MIT © 2022 spadeteam

Versions

Release
1.0.1+1.20
fabric, quilt · 1.20, 1.20.1 · 35mo ago
- Fixed resource reloading
430
Release
1.0.1+1.19.4
fabric, quilt · 1.19.4 · 35mo ago
- Fixed resource reloading
145
Release
1.0.1+1.19
fabric, quilt · 1.19, 1.19.1, 1.19.2 · 35mo ago
- Fixed resource reloading
159
Release
1.0.0+1.20
fabric, quilt · 1.20 · 36mo ago
- Updated to 1.20
173
Release
1.0.0+1.18.2
fabric, quilt · 1.18.2 · 39mo ago
- Backported to 1.18.2
137
Release
1.0.0+1.19.4
fabric, quilt · 1.19.4 · 39mo ago
- Updated to 1.19.4
139
Release
1.0.0+1.19.3
fabric, quilt · 1.19.3 · 42mo ago
- Ported to 1.19.3
163
Release
1.0.0+1.19
fabric, quilt · 1.19, 1.19.1, 1.19.2 · 42mo ago
- Fixed even more null checking (now it's not `fromJson`'s problem).
150
Beta
1.0.0-beta.2+1.19
fabric, quilt · 1.19, 1.19.1, 1.19.2 · 42mo ago
- Fixed some weird null checking - Criteria files now have a global `optional` directive
123
Beta
1.0.0-beta.1+1.19.3
fabric, quilt · 1.19.3 · 42mo ago
First beta on 1.19.3!
117
Beta
1.0.0-beta.1+1.19
fabric, quilt · 1.19, 1.19.1, 1.19.2 · 42mo ago
First beta!
127

Comments 0

No comments yet. Be the first to share your thoughts.