|
|
(5 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| <includeonly>{{ #ifeq: {{{noheader|{{ #var:craftingtableheader|0}}}}} | 1 ||{{ #vardefine:craftingtableheader| 1 }}<table class="wikitable sortable collapsible"><tr align="center">{{ #ifeq: {{{mode|full}}} | full |{{ #vardefine:craftinglabels|1}}<th>Name</th>|{{ #vardefine:craftinglabels|0}}}}<th>Ingredients</th><th class="unsortable collapse-button">[[Crafting]] recipe</th></tr>}}{{ #vardefine:craftingrowmode|shaped}}{{ #if: {{{1|}}} |{{ #vardefine:craftingrowmode|shapeless}} }}{{ #if: {{{rowmode|}}}|{{ #vardefine:craftingrowmode|{{{rowmode}}}}} }}<tr><!-- | | <includeonly>{{#invoke:crafting|table}}</includeonly> |
|
| |
|
| Name
| |
|
| |
| -->{{ #ifeq: {{#ifeq: {{{mode|}}} | full | 1 | {{ #var:craftinglabels|0}} }} | 1 |<th>{{#if: {{{name|}}} | {{{name}}} | {{ #ifeq: {{ #var:craftingrowmode}} | custom | {{{Output}}} | {{Template:Crafting/Parse|{{{Output|}}}|output}} }}{{ #ifeq: {{{upcoming|0}}} | 1 |<br />(upcoming)[[Category:Upcoming]]}} }}</th>}}<!--
| |
|
| |
| Ingredients
| |
|
| |
| --><td style="text-align: center">{{
| |
| #if: {{{ingredients|}}}
| |
| | {{{ingredients}}}
| |
| | {{
| |
| #switch: {{#var:craftingrowmode}}
| |
| |shapeless={{Template:Crafting/Ingredients|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}} }}
| |
| |shaped={{Template:Crafting/Ingredients|{{{A1|}}}|{{{B1|}}}|{{{C1|}}}|{{{A2|}}}|{{{B2|}}}|{{{C2|}}}|{{{A3|}}}|{{{B3|}}}|{{{C3|}}} }}
| |
| |custom={{{1}}}
| |
| |#default=<span class="error">error in {{tl|Crafting}}: unknown <tt><nowiki>{{{rowmode}}}</nowiki></tt></span>
| |
| }}
| |
| }}</td><!--
| |
|
| |
| Crafting recipe
| |
|
| |
| --><td>{{
| |
| #switch: {{#var:craftingrowmode}}
| |
| |shapeless={{Grid/Crafting Table|shapeless=1|B2={{Template:Crafting/Parse|{{{1|}}}|table}}|A2={{Template:Crafting/Parse|{{{2|}}}|table}}|B3={{Template:Crafting/Parse|{{{3|}}}|table}}|A3={{Template:Crafting/Parse|{{{4|}}}|table}}|C2={{Template:Crafting/Parse|{{{5|}}}|table}}|C3={{Template:Crafting/Parse|{{{6|}}}|table}}|B1={{Template:Crafting/Parse|{{{7|}}}|table}}|A1={{Template:Crafting/Parse|{{{8|}}}|table}}|C1={{Template:Crafting/Parse|{{{9|}}}|table}}|Output={{Template:Crafting/Parse|{{{Output|}}}|table}}|Otitle={{{Otitle|}}} }}
| |
| |shaped={{Grid/Crafting Table|A1={{Template:Crafting/Parse|{{{A1|}}}|table}}|B1={{Template:Crafting/Parse|{{{B1|}}}|table}}|C1={{Template:Crafting/Parse|{{{C1|}}}|table}}|A2={{Template:Crafting/Parse|{{{A2|}}}|table}}|B2={{Template:Crafting/Parse|{{{B2|}}}|table}}|C2={{Template:Crafting/Parse|{{{C2|}}}|table}}|A3={{Template:Crafting/Parse|{{{A3|}}}|table}}|B3={{Template:Crafting/Parse|{{{B3|}}}|table}}|C3={{Template:Crafting/Parse|{{{C3|}}}|table}}|Output={{Template:Crafting/Parse|{{{Output|}}}|table}}|Otitle={{{Otitle|}}} }}
| |
| |custom={{{2}}}
| |
| |#default=<span class="error">error in {{tl|Crafting}}: unknown <tt><nowiki>{{{rowmode}}}</nowiki></tt></span>
| |
| }}</td></tr>{{ #ifeq: {{{foot|}}}| 1 |</table>{{ #vardefine:craftingtableheader| 0 }}}}<!--
| |
|
| |
| DPL categories
| |
|
| |
| -->{{#vardefine: items | {{#replace:
| |
| ;{{{A1|}}};{{{B1|}}};{{{C1|}}};
| |
| ;{{{A2|}}};{{{B2|}}};{{{C2|}}};
| |
| ;{{{A3|}}};{{{B3|}}};{{{C3|}}};
| |
| ;{{{1|}}};{{{2|}}};{{{3|}}};
| |
| ;{{{4|}}};{{{5|}}};{{{6|}}};
| |
| ;{{{7|}}};{{{8|}}};{{{9|}}};
| |
| }} }}{{
| |
| #if: {{{nocat|}}}{{NAMESPACE}}{{#pos: {{#var: items }} | : }}{{{mod|}}}{{#pos: {{PAGENAME}} | / }}
| |
| | <!-- No cats -->
| |
| | {{
| |
|
| |
| }}</includeonly>
| |
| <noinclude> | | <noinclude> |
| {{Template:Crafting/doc}} | | {{/doc}} |
| [[Category:Templates]] | | [[Category:Templates]] |
| </noinclude> | | </noinclude> |
Documentation
Using this template, you can create tables like those commonly used in the “Crafting” and “As a crafting ingredient” sections of articles about blocks and items. It can be used similarly to {{Grid/Crafting Table}}, except it creates the table for you.
By default, the table generates with 3 columns: Name, Ingredients, and the main column containing {{Grid/Crafting Table}}. You can set the parameter {{{mode=noname}}} in the first template of the table to hide the Name column. You also need to set {{{foot=1}}} in the last template of the table.
Displaying a shapeless recipe can be accomplished by simply leaving out the grid positions for all ingredients. If the recipe is shapeless and uses less than 5 slots, the template will automatically arrange the items into the bottom-left square, indicating that the recipe can be used in the inventory crafting area.
Example usage:
{{Crafting
|head=1
|B2=Coal
|B3=Stick
|Output=Torch,4
}}
{{Crafting
|Blaze Powder
|Gunpowder
|Coal
|Output=Fire Charge,3
}}
{{Crafting
|A1= Coal |B1= Coal |C1= Coal
|A2= Coal |B2= Coal |C2= Coal
|A3= Coal |B3= Coal |C3= Coal
|Output=Block of Coal
|upcoming=1
}}
{{Crafting
|name=[[Pickaxe]]
|ingredients=[[Stick]]s +<br>[[Wood Planks]] or<br> [[Cobblestone]] or<br>[[Iron Ingot]]s or<br>[[Gold Ingot]]s or<br>[[Diamond]]s
|A1=Wooden Plank; Cobblestone; Iron Ingot; Gold Ingot; Diamond
|B1=Wooden Plank; Cobblestone; Iron Ingot; Gold Ingot; Diamond
|C1=Wooden Plank; Cobblestone; Iron Ingot; Gold Ingot; Diamond
|B2=Stick
|B3=Stick
|Output=Wooden Pickaxe; Stone Pickaxe; Iron Pickaxe; Gold Pickaxe; Diamond Pickaxe
|foot=1
}}
produces: