Skip to content

Modular Capabilities and State Variables

CraftingEngine decouples recipes from hardcoded block materials using Capabilities and State Variables. Rather than requiring an ANVIL or FURNACE directly, recipes require abstract traits like forging, heating, or pressure.


1. What are Capabilities?

Capabilities represent functional attributes that workstations or the environment provide:

+---------------------+ +------------------------+
| Recipe Requirements | | Workstation Definition |
+---------------------+ +------------------------+
| - forging | <=======> | capabilities: |
| - high_temperature | | - forging |
+---------------------+ | - high_temperature |
+------------------------+

Why use Capabilities?

  • Multiple Stations, One Recipe: A single “Folded Steel” blueprint can be crafted at a humble Iron Anvil, a massive 3D Runic Forge, or an industrial power press, as long as they provide the forging capability.
  • Dynamic Tiering: Capabilities can define levels (e.g. heating_tier_1, heating_tier_2).
  • Conditional Activation: A workstation may provide a capability only when powered by redstone or heated by lava below.

2. Defining Capabilities (capabilities/*.yml)

Capabilities can be defined as standalone YAML files inside plugins/CraftingEngine/capabilities/:

id: "high_temperature"
name: "<gradient:#ff8a80:#ff5252>High Temperature</gradient>"
description: "Requires ambient heat exceeding 300°C."
# Conditions required for this capability to be considered active
evaluations:
- type: "BLOCK_STATE"
offset: [0, -1, 0] # Inspect block underneath the station
materials:
- "LAVA"
- "MAGMA_BLOCK"
- "SOUL_FIRE"
variables:
temperature:
initial: 350.0
decay_rate: 1.5

3. State Variables Storage

Workstations and active processes maintain isolated, sealed state variable maps:

  • temperature: Current heat level in °C.
  • fluid_level: Millibuckets (mB) of fluid present in a basin.
  • pressure: Hydraulic or steam pressure in PSI.
  • durability: Structural integrity of custom workstation blocks.

Referencing Variables in Blueprints

You can check state variables directly within blueprint condition expressions:

requirements:
conditions:
- id: "heat_check"
environment: "craftingengine"
condition: "capability.temperature >= 250"

Next Steps