Data Criteria

Quick rating

Community listing page, reviews here may not be monitored by the author.

Data Criteria

By spadeteam , acikekOwner

No reviews yet

Data-driven advancement criteria

Mod Loaders
Minecraft

About

Description

Data-driven advancement criteria.

Why?

Check out this page for an example of creating advancement criteria without this mod. See the 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

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