Crucible Recipes

Crucible crafting is performed at the Crucible and transforms items by cooking them in aspect-tagged liquid. It is the primary way to create alchemical ingredients and some Thaumcraft components.

Registration

ThaumcraftApi.addCrucibleRecipe(String key,       // Research key
    ItemStack result,     // Output item
    Object catalyst,      // ItemStack, String (Ore Dict), or ArrayList<ItemStack>
    AspectList tags)      // Aspect requirements

Parameters

Parameter Type Description
key String Research key required to discover/use this recipe
result ItemStack The output item
catalyst Object Input item(s) being cooked; ItemStack, String (Ore Dict), or ArrayList<ItemStack>
tags AspectList Aspects that must be present in the crucible for the recipe to fire

Example: Single Item Catalyst

ThaumcraftApi.addCrucibleRecipe("RESEARCH_KEY",
    new ItemStack(TCItems.itemResource, 1, 2),   // Salis Mundus
    new ItemStack(Items.diamond),
    new AspectList()
        .add(Aspect.EARTH, 10)
        .add(Aspect.ORDER, 5));

Example: Ore Dictionary Catalyst

// Uses any item registered to the "gemDiamond" Ore Dictionary entry
ThaumcraftApi.addCrucibleRecipe("RESEARCH_KEY",
    new ItemStack(TCItems.itemResource, 1, 2),
    "gemDiamond",                                   // String → OreDictionary
    new AspectList()
        .add(Aspect.EARTH, 10)
        .add(Aspect.ORDER, 5));

Example: Multiple Possible Catalysts

ThaumcraftApi.addCrucibleRecipe("RESEARCH_KEY",
    new ItemStack(TCItems.itemResource, 1, 3),
    new ArrayList<ItemStack>(Arrays.asList(
        new ItemStack(Blocks.dirt),
        new ItemStack(Blocks.cobblestone)
    )),
    new AspectList().add(Aspect.EARTH, 8));

CrucibleRecipe Class

public class CrucibleRecipe {
    private ItemStack recipeOutput;
    public Object catalyst;
    public AspectList aspects;
    public String key;
    public int hash;
}

Constructor

public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags)

The constructor accepts the same parameters as addCrucibleRecipe. When catalyst is a String, it resolves immediately to an ArrayList<ItemStack> via OreDictionary.getOres().

A hash is computed from: researchKey + result.toString() + all aspect tags/amounts + catalyst.toString().

Methods

Method Returns Description
matches(AspectList itags, ItemStack cat) boolean Checks if the given aspects and catalyst satisfy this recipe
catalystMatches(ItemStack cat) boolean Checks if the catalyst matches (without checking aspects)
removeMatching(AspectList itags) AspectList Returns a new AspectList with this recipe’s aspects removed
getRecipeOutput() ItemStack The output ItemStack

matches()

public boolean matches(AspectList itags, ItemStack cat)

Returns true only if:

  1. The catalyst matches the input item (ThaumcraftApiHelper.itemMatches or Ore Dictionary match)
  2. The crucible’s aspect pool contains at least the required amount of each aspect
// Aspect sufficiency check
for (Aspect tag : aspects.getAspects()) {
    if (itags.getAmount(tag) < aspects.getAmount(tag)) return false;
}

removeMatching()

public AspectList removeMatching(AspectList itags)

Returns a new AspectList with this recipe’s aspect costs subtracted. The original AspectList is not modified.

AspectList remaining = recipe.removeMatching(currentAspectsInCrucible);

catalystMatches()

public boolean catalystMatches(ItemStack cat)

A fast check for catalyst compatibility without validating aspect requirements.

Finding Recipes

// By output ItemStack
CrucibleRecipe recipe = ThaumcraftApi.getCrucibleRecipe(ItemStack stack);

// By computed hash
CrucibleRecipe recipe = ThaumcraftApi.getCrucibleRecipeFromHash(int hash);

// Iterate all crucible recipes
for (Object r : ThaumcraftApi.getCraftingRecipes()) {
    if (r instanceof CrucibleRecipe) {
        CrucibleRecipe cr = (CrucibleRecipe) r;
        // ...
    }
}

Research Key Caching

The API maintains a keyCache that maps output ItemStacks to their research key and page index. This is used internally to unlock recipe tooltips.

// Internal method
private static HashMap<Object, Object[]> keyCache

The getCrucibleRecipe method also updates this cache when a matching recipe is found.