Module crafting

Source
Expand description

Recipe preview and execution on a copy, committed only after all costs and outputs fit.

Structs§

CraftPreview
An owned snapshot of crafting availability and missing ingredients.
MissingIngredient
One missing ingredient, aggregated across every input with the same item ID. See preview for an example. Amounts use u64 so up to 32 u32 costs remain exact even when the required total exceeds inventory stack limits.

Functions§

craft
Inputs/outputs are host-authored trusted recipe data, never client prices. Repeated ingredients are summed by sequential removal. At most 32 of each. Output capacity is evaluated after consuming inputs, allowing slot reuse. See preview for a non-mutating availability check and usage example.
preview
Inspect the same trusted recipe accepted by craft without changing inventory.