Crafting requirements

Crafting requirements are used by schematics to determine if the schematic is applicable in a given context, based on the target itemstack, player and the world.

And crafting requirement

Passes if ALL of the given requirements pass.

Format:
typetetra:and
requirements
array[
Crafting requirements
]

All requirements in this array must pass for this requirement to pass.

Example:
{
  "type": "tetra:and",
  "requirements": [
    {
      "type": "tetra:never"
    },
    {
      "type": "tetra:never"
    }
  ]
}

Or crafting requirement

Passes if ANY of the given requirements pass.

Format:
typetetra:or
requirements
array[
Crafting requirements
]

At least one requirement in this array must pass for this requirement to pass.

Example:
{
  "type": "tetra:or",
  "requirements": [
    {
      "type": "tetra:never"
    },
    {
      "type": "tetra:never"
    }
  ]
}

Not crafting requirement

Passes if the given requirement does NOT pass.

Format:
typetetra:not
requirementCrafting requirements

The parent requirement passes if this requirement does not.

Example:
{
  "type": "tetra:not",
  "requirement": {
    "type": "tetra:never"
  }
}

Accepts improvement crafting requirement

Passes if the module in the target slot accepts the given improvement, optionally at the given level. todo: change the level field to use an integer predicate (breaking change).

Format:
typetetra:accepts_improvement
improvementstring

Passes if the module in the target slot accepts an improvement with a key matching this value. Accepts as in the module references an improvements resource which define an improvement with the key.

leveloptionalnumber

In addition to accepting the improvement it also has to be accepted specifically at this level.

Example:
{
  "type": "tetra:accepts_improvement",
  "improvement": "blade/serrated",
  "level": 5
}

Aspect crafting requirement

Passes if the module (including its improvements) in the target slot has the given aspect, optionally matching the given level predicate.

Format:
typetetra:aspect
aspectstring

The module (including its improvements) in the target slot has to have this aspect.

leveloptionalInteger predicate

In addition to having the aspect the level of the aspect also has to match this predicate.

Example:
{
  "type": "tetra:aspect",
  "aspect": "edged_weapon",
  "level": {
    "min": 2
  }
}

Feature flag crafting requirement

Passes if the given feature flag is enabled. Internal use, please chill.

Format:
typetetra:feature_flag
featureoptionalstring

This feature flag has to be enabled.

Locked crafting requirement

Passes if some nearby block provides a schematic key matching the given schematic key, the providing block typically determines under which conditions it wants to provide its schematic(s).

Format:
typetetra:locked
keyResource location

This schematic key that has to be provided by a nearby block.

Module crafting requirement

Passes if the module in the target slot matches the given parameters. When it makes sense to use, using aspects instead of relying on this requirement would make for better compat between addons. Omitting all fields would make this requirement pass if a module is present in the target slot, but fail if it's empty.

Format:
typetetra:module
moduleoptionalstring

The key of the module has to match this if present.

variantoptionalstring

The key of the module variant has to match this if present.

materialoptionalstring

When present, attempts to extract a material string from the variant key to be matched against this value.

Example:
{
  "type": "tetra:module",
  "module": "double/adze_right"
}

Slot crafting requirement

Passes if the target slot matches the given slot.

Format:
typetetra:slot
slotstring

The target slot has to match this slot.

Example:
{
  "type": "tetra:slot",
  "slot": "sword/blade"
}

Never crafting requirement

Never passes, no surprises.

Format:
typetetra:never