Template:Crafting table: Difference between revisions
imported>Ttv pedro270707 mNo edit summary |
imported>Ttv pedro270707 m (Fixed items with large amounts of quantities not working properly, improved code legibility) |
||
| Line 7: | Line 7: | ||
--><tr>{{#ifeq: {{#var:name|}} | n | | | --><tr>{{#ifeq: {{#var:name|}} | n | | | ||
<th>'''{{#ifeq: {{#var:name-str|}} | y | {{#ifeq: {{#var:exists-{{ | <th>'''{{#ifeq: {{#var:name-str|}} | y | | ||
}}<!-- | {{#vardefine:item|{{#arraydefine:item|{{{RESULT|}}}|,}}{{#arrayindex:item|0}}}} | ||
{{#ifeq: {{#var:exists-{{#var:item}}}} | y | | |||
{{#ifeq: {{#var:item}} | {{FULLPAGENAME}} | {{#var:item}} | [[{{#var:item}}]]}} | |||
| {{#ifeq: {{#var:exists-{{#var:item}}}} | n | | |||
{{#var:item}} | |||
| {{#ifexist: {{#var:item}} | {{#vardefine:exists-{{#var:item}}|y}} | |||
{{#ifeq: {{#var:item}} | {{FULLPAGENAME}} | {{#var:item}} | [[{{#var:item}}]]}} | |||
| {{#vardefine:exists-{{#var:item}}|n}}{{#var:item}} }} }} }} {{#vardefine:item|}} | |||
| {{#var:name-str|}} | |||
}}'''</th> <!-- If name is not a boolean, it displays the text in the name parameter instead --> | |||
}}<!-- | |||
-->{{#ifeq: {{#var:ingredients|}} | n | | | -->{{#ifeq: {{#var:ingredients|}} | n | | | ||
<td>{{#switch: {{#var:type|workbench}} | <td>{{#switch: {{#var:type|workbench}} | ||
| workbench | inventory = {{#fornumargs: argnum | argval | | | workbench | inventory = {{#fornumargs: argnum | argval | | ||
{{#arraydefine:items|{{#var:argval}}|;}} | |||
{{#vardefine:items-length|{{#expr: 0{{#arrayprint:items||@@@@| | |||
| furnace | blast-furnace = '''{{#ifeq: {{#var:exists-{{ | {{#vardefine:item|{{#arraydefine:item|@@@@|,}}{{#arrayindex:item|0}}}} | ||
{{#ifeq: {{#var:item-{{#var:item}}-{{#var:crafting-table-index|0}}}} | y | | +1}} | |||
}} | |||
}} | |||
}}<!-- | |||
-->{{#ifeq: {{#var:first-ingredients|}} | y | | |||
{{#ifeq: {{#var:items-length|0}} | 0 | | +<br>}} | |||
| {{#vardefine:first-ingredients|y}} | |||
}} | |||
{{#vardefine:first-table-item|y}} | |||
{{#arrayprint:items||@@@@| | |||
{{#vardefine:item|{{#arraydefine:item|@@@@|,}}{{#arrayindex:item|0}}}} | |||
{{#ifeq: {{#var:item-{{#var:item}}-{{#var:crafting-table-index|0}}}} | y | | | |||
{{#if: {{#var:first-table-item|}} | {{#vardefine:first-table-item|}} | or<br>}} | |||
'''{{#ifeq: {{#var:item}} | {{FULLPAGENAME}} | | |||
{{#var:item}} | |||
| {{#ifexist: {{#var:item}} | |||
| [[{{#var:item}}]] | |||
| {{#var:item}}}} }}''' | |||
{{#vardefine:item-{{#var:item}}-{{#var:crafting-table-index|0}}|y}} | |||
}} | |||
{{#vardefine:item|}}{{#arrayreset:item}}}}{{#vardefine:items-length|}} | |||
}} | |||
| furnace | blast-furnace = | |||
{{#vardefine:item|{{#arraydefine:item|{{{input|}}}|,}}{{#arrayindex:item|0}}}} | |||
'''{{#ifeq: {{#var:exists-{{#var:item}}}} | y | | |||
{{#ifeq: {{#var:item}} | {{FULLPAGENAME}} | {{#var:item}} | [[{{#var:item}}]]}} | |||
| {{#ifeq: {{#var:exists-{{#var:item}}}} | n | | |||
{{#var:item}} | |||
| {{#ifexist: {{#var:item}} | |||
| {{#vardefine:exists-{{#var:item}}|y}} | |||
{{#ifeq: {{#var:item}} | {{FULLPAGENAME}} | {{#var:item}} | [[{{#var:item}}]]}} | |||
| {{#vardefine:exists-{{#var:item}}|n}}{{#var:item}} | |||
}} | |||
}} | |||
}}''' | |||
{{#vardefine:item|}} | |||
}}</td> | }}</td> | ||
}}<td style="padding: 0; text-align: center;">{{#switch: {{#var:type|workbench}} | }}<td style="padding: 0; text-align: center;">{{#switch: {{#var:type|workbench}} | ||
Revision as of 01:45, 30 March 2023
[view | | | ]Documentation
This template generates a {{Crafting}} table. Each row contains an item's recipe.
Arguments
| Argument | Default value | Note |
|---|---|---|
type |
workbench |
Sets the recipe's type. Valid values are workbench, inventory, furnace and blast-furnace.
|
1 |
Nothing | The first slot from left to right, top to bottom. Only works if type is set to either workbench or inventory.
|
2 |
Nothing | The second slot from left to right, top to bottom. Only works if type is set to either workbench or inventory.
|
3 |
Nothing | The third slot from left to right, top to bottom. Only works if type is set to either workbench or inventory.
|
4 |
Nothing | The fourth slot from left to right, top to bottom. Only works if type is set to either workbench or inventory.
|
5 |
Nothing | The fifth slot from left to right, top to bottom. Only works if type is set to workbench.
|
6 |
Nothing | The sixth slot from left to right, top to bottom. Only works if type is set to workbench.
|
7 |
Nothing | The seventh slot from left to right, top to bottom. Only works if type is set to workbench.
|
8 |
Nothing | The eighth slot from left to right, top to bottom. Only works if type is set to workbench.
|
9 |
Nothing | The ninth slot from left to right, top to bottom. Only works if type is set to workbench.
|
shapeless |
n |
Defines if the recipe is shapeless. Note that this means that any arrangement of the items works, not that a specific arrangement can go anywhere in the crafting grid. Only works if type is set to either workbench or inventory.
|
input |
Nothing | The input slot. Only works if type is set to either furnace or blast-furnace.
|
fuel |
Default fuel items | The fuel slot. Only works if type is set to either furnace or blast-furnace. Its default value will be based on the type of furnace.
|
RESULT |
Nothing | The result of the crafting recipe. |
name |
y |
Defines if the name of the result will be shown. Can either be set to a boolean (y or n) or to a value to be displayed.
|
ingredients |
y |
Defines if the ingredients used in the recipe will be shown. Can either be set to a boolean (y or n) or to a value to be displayed.
|
foot |
n |
Should be set to y at the last row of the table.
|
Usage
| Code | Output | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
{{Crafting table|1=Block of Diamond|RESULT=Diamond,9|foot=y}} |
| |||||||||
{{Crafting table|type=inventory|1=Block of Diamond|RESULT=Diamond,9|foot=y}} |
| |||||||||
{{Crafting table|type=furnace|input=Stone Diamond Ore|RESULT=Diamond|foot=y}} |
| |||||||||
{{Crafting table|type=blast-furnace|input=Iron Ingot|RESULT=Crude Steel|foot=y}} |
| |||||||||
{{Crafting table
|type=workbench
|1=String
|2=Cloth
|3=Cloth
|4=String
|5=Leather
|6=Leather
|8=Leather
|9=Leather
|RESULT=Empty Quiver
|foot=y
}}
|
| |||||||||
{{Crafting table
|type=blast-furnace
|input=Iron Ingot
|RESULT=Crude Steel
}}
{{Crafting table
|type=furnace
|input=Stone Coal Ore
|RESULT=Coal
|foot=y
}}
|
|
[view | | | ]The above documentation is transcluded from Template:Crafting table/doc.