Template:Recipes/doc

This template is used to display crafting recipes. It is a reimplementation of the crafts template system that is dynamic, more efficient, and more maintainable.

The recipes system depends on the existence of subpages of  (e.g. Exxo Avalon/Recipes/Hardmode Forge), so-called recipes registration subpages. These pages store the crafting information (which would otherwise be stored on every item's page), grouped by crafting station. If all recipes are stored on those subpages, then it is possible to display the crafting information for any result or ingredient item via recipes. This facilitates easy updatability in case of patches, as only the recipes registration subpages have to be edited and the information will automatically be updated across the wiki.

Important note: As with item, all non-vanilla content like items and crafting stations must be prepended by a hash character (e.g.,  ) within the entirety of recipes!

Query parameters
The basic usage of recipes is to query information. There are three query constraint options:

List only recipes that use these stations.
 * = station1/station2/...

Exclude recipes that use these stations.
 * = station1/station2/...

List only recipes that create this item. It is also possible to do pattern search using SQL LIKE syntax. Example:, multiple:. Note that "LIKE" must be all uppercase.
 * = result1/result2/...

Exclude recipes that create this item. It is also possible to do pattern search using SQL LIKE syntax. Example:, multiple:. Note that "LIKE" must be all uppercase.
 * = result1/result2/...

List only recipes that use these items as ingredients.
 * = ingredient1/ingredient2/...

It is also possible to do pattern search using SQL LIKE syntax. Example:, multiple:. Note that "LIKE" must be all uppercase.

NOTE: The relationship between the above parameters is "and", and the relationship of multiple values inside a single parameter is "or". For example,  means (in SQL style):

Defines a custom constraint using SQL  syntax. If specified, all of above parameters are ignored. Used to write complex queries when necessary, use with caution. See the cargo table for the queried database and its fields.
 * = whereString

Other parameters
The following parameters are used for certain formatting specifics:

Adds a title bar to the recipes table, with specified text.

Turn off result & ext cols grouping.
 * = n/no

If set, the "Crafting station" column will be hidden. If it is not hidden, then it will display the crafting station as it is formatted in the  parameter of the recipes call on the respective recipes registration subpage. (For instance, Exxo Avalon recipes with "Adamantite Forge" set as the crafting station will always display the "Adamantite Forge or Titanium Forge or Troxinium Forge" that is set as the  of the recipes call on Exxo Avalon/Recipes/Hardmode Forge, which also has  .) If that cannot be determined, then it falls back to the default set of formatting rules from the vanilla wiki, and finally to simply.
 * = y

Turn off the "Crafting station" column grouping. Only valid when  is not set.
 * = n/no

If set, result items will show their internal item IDs (if available).
 * = y

By default, this template will add the page on which it is used to the respective  category (e.g. Category:Exxo Avalon/Adamantite Forge or Titanium Forge or Troxinium Forge) if the crafting result is the page title itself. Using  will disable this. Using  will force the categorization, no matter what the result and page title are. The  part of the category name will default to simply the exact station as it is registered, but it can be overriden in the   parameter of the recipes call on the respective recipes registration subpage. (For instance, Exxo Avalon recipes with "Adamantite Forge" set as the crafting station will be categorized in Category:Exxo Avalon/Adamantite Forge or Titanium Forge or Troxinium Forge (and not in Category:Exxo Avalon/Adamantite Forge), as that is set as the  in the recipes call on Exxo Avalon/Recipes/Hardmode Forge, which also has  .)
 * = no/force

Set to  to stop the result items from linking to their pages.
 * = n/no

Assert the expected number of rows in this crafts table. If the expected and actual number of rows are not equal, this page will be added to Category:Recipes table with unexpected total number of rows.
 * = number

Makes the table unsortable.
 * = n/no

HTML class/id/style attributes for the outer wrapper div element.

Examples
For this example, it is assumed we are in the Exxo Avalon mod wiki.

This code selects all recipes that use as an ingredient and are crafted at the. It excludes the and the  recipes. There are three items whose recipes match these requirements (,, and ), so we expect three rows.

Register recipes
On the recipes registration subpages, recipes are registered using recipes/register. For the usage of recipes/register, see its documentation.

Custom Result Cells
= template name used for format result cell.

This template will receive the following arguments:
 * ,,  : options for item template used by default display.
 * ,,  ,  ,  ,  : infomation about crafting result.

"@@@@" in template output will be replaced with the default result display.

See Chairs for an example.

Custom Table Header

 * = content of result , default is
 * = content of ingredients , default is
 * = content of crafting station , default is

Adding extra columns/rows around crafting stations
Only valid when  is not set.

Define cols: ... Column headers before crafting station column

... Column headers before crafting station column

Define index key for row content: Define index key for "Furnace"(as  parameter), for example
 * = _a

Define actual contents: ... ... Define contents for  using index key.

Adding extra cols/rows around by crafting results
Define columns: ... ... ... ... The order in which all columns are displayed is: s •  •  s •   •  s •  s •   •  s •  s

Define index key for row content: Define index key for a row(Priority in this order): Define by row number Define by result name + version info Define by result name
 * = _a
 * = _a
 * = _a

Define actual contents: ... Define contents for  using index key, corresponding to the definition of columns.

Adding extra rows
NOTE: extra rows don't count as part of.

Before recipe rows: ... ...

After recipe rows: ... ...

See Bars and Recovery potions for examples.

Extract component
Some components of a recipe can be extracted and formatted separately, see recipes/extract.

Count for result rows
You can use recipes/exist and recipes/count to check the existence and number of results of recipes that meet query constraints. Note: you should use to check the existence instead of, because the former is much faster and cheaper.