Download Data Criteria — Minecraft Mods — MetaMods

Data Criteria

Active

Downloads

0

Last update

2 years ago

Versions

1.18.2 — 1.20.1
Server
Fabric
Quilt
Libraries
Utils

Data Criteria

What is this mod for?

The Data Criteria mod solves the problem of creating complex conditions for achievements in Minecraft. Without this mod, developers have to write lots of repetitive code to check various parameters. Data Criteria offers an elegant solution through a data-driven system.

How it works

The system allows you to create custom achievement criteria using JSON files. You define the parameters you want to check, and the mod automatically generates the necessary logic.

Creating a criterion

First, create a criterion file in the data/your_namespace/criteria/ folder. In this file, you specify the parameters that will be checked:

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

Parameters are specified in strict order, and optional parameters must be placed at the end of the list.

Using in achievements

After creating the criterion, you can use it in achievement files:

{
  // ...
  "criteria": {
    "test": {
      "trigger": "your_namespace:int_and_bool",
      "conditions": {
        "number": 5
        // The 'possible' parameter is optional
      }
    }
  }
  // ...
}

Activation through code

To activate the criterion, use the mod's API:

DataCriteriaAPI.trigger(
    new Identifier("your_namespace:int_and_bool"),
    serverPlayer,
    // Parameters start here
    10, true
);

Advantages

  • Reduces the amount of repetitive code
  • Simplifies creating complex conditions
  • Allows easy functionality expansion
  • Integrates with the existing achievement system

License: MIT © 2022 spadeteam

Project members
acikek

acikek

Created: 21 Dec 2022

ID: 2476