Template:Infobox block: Difference between revisions

Added an optional second tool param for pages like door and farming
No edit summary
 
(384 intermediate revisions by 67 users not shown)
Line 1: Line 1:
<table class="infobox" cellpadding="4" style="width: 22em; font-size: 90%; float:right; border: 1px solid #AAAAAA; margin-left:0.5em">
{{#invoke:infobox|infobox
<tr>
| invimage = title
  <td align="center" colspan=2 bgcolor="#CCCCCC" style="font-size:120%; font-weight: bold;">{{{name|{{BASEPAGENAME}}}}}</td>
| rows =
</tr>
{{#if: {{{rarity|}}} | {{infobox row|class=list-style-none|label=[[minecraft:Rarity|Rarity color]]|field={{ucfirst:{{{rarity|}}}}} }} | }}
<tr valign="top">
{{#if: {{{renewable|}}} | {{infobox row|label=[[minecraft:Renewable resource|Renewable]]|field={{{renewable}}} }} }}
  <td align="center" colspan="2">[[image:{{{image|No image.png}}}|150px|center]]</td>
{{#if: {{{stackable|}}} | {{infobox row|label=Stackable|field={{{stackable}}} {{#if: {{{maxStack|}}} | &nbsp;({{{maxStack}}}) }} }} |<!-- {{{stackable}}} not provided => --->{{#if: {{NAMESPACE}} || {{translation category|project=0|Missing stackability}}}} }}
</tr>
{{infobox row|label=Tool{{ #if: {{{tool2|}}} | s }}|class=pixel-image|field={{{tool|}}}{{
{{Block/row|label=Type|field={{{type|?}}}}}
  #if: {{{tool2|}}} | {{{tool2|}}}
{{#switch:{{lc:{{{type}}}}}|solid block|solid|block =
}}{{
{{Block/row|label=Requirements|field={{#switch:{{lc:{{{dirt}}}}}|yes=Sunlight and dirt|no=None|sand=Sunlight and sand|#default={{{dirt|?}}}}} }}
  #if: {{{tool3|}}} | {{{tool3|}}}
}}
}} }}
{{Block/row|label=Physics|field={{{gravity|?}}}}}
{{infobox row|label=[[minecraft:Explosion#Blast resistance|Blast resistance]]|field={{ #if: {{{tntres|}}}
{{Block/row|label=Transparency|field={{{transparent|?}}}}}
| {{{tntres}}}{{#if: {{NAMESPACE}} || {{translation category|project=0|Pages with overridden tntres}} }}
{{Block/row|label=Luminance|field={{{light|?}}}}}
| {{Blast resistance values | {{#if: {{{title|}}} | {{{title}}} | {{#titleparts: {{BASEPAGENAME}} }} }} }}
{{Block/row|label=Tool{{#if:{{{tool2|}}}|s| }}|field={{#switch:{{lc:{{{tool|{{{Tool}}} }}} }}|<!---
}} }}
 
{{infobox row|label=[[minecraft:Breaking#Blocks by hardness|Hardness]]|field={{ #if: {{{hardness|}}}
The images are set input side because the majority of pages use the images as value entered into the field. Not having them breaks it for those pages. And most pages reference {{{Tool}}} not {{{tool}}}, its case sensitive.
| {{{hardness}}}{{#if: {{NAMESPACE}} || {{translation category|project=0|Pages with overridden hardness}} }}
 
| {{Hardness values | {{#if: {{{title|}}} | {{{title}}} | {{#titleparts: {{BASEPAGENAME}} }} }} }}
--->|[[file:use-pickaxe.png]]|pick|pickaxe=[[File:Use-pickaxe.png]]<!--
}} }}
--->|[[file:use-spade.png]]|spade|shovel=[[File:Use-spade.png]]<!--
{{#if: {{{durability|}}} |{{infobox row|Durability|{{{durability|}}}}}}}
--->|[[file:use-axe.png]]|axe=[[File:Use-axe.png]]<!--
{{infobox row|label=[[minecraft:Light|Luminous]]|field={{ #if: {{{light|}}} | {{{light}}} {{#if: {{{lightLevel|}}} | &nbsp;({{{lightLevel}}}) }} | ? {{#if: {{NAMESPACE}} || {{translation category|project=0|Missing luminance}}}} }} }}
--->|[[file:use-hoe.png]]|hoe|ho=[[File:Use-hoe.png]]<!--
{{infobox row|label=[[minecraft:Opacity|Transparent]]|field={{ #if: {{{transparent|}}} | {{{transparent}}} | ? {{#if: {{NAMESPACE}} || {{translation category|project=0|Missing transparency}}}} }} }}
--->|n/a|none=N/A<!--
{{ #if: {{{waterloggable|}}} | {{infobox row|label=[[minecraft:Waterlogging|Waterloggable]]|field={{{waterloggable}}} }} }}
--->|#default=?}}<!--
{{ #if: {{{heals|}}} | {{infobox row|label=[[minecraft:Food|Restores]]|field={{{heals}}} }} }}
--->{{#switch:{{lc:{{{tool2}}} }}|<!--
{{infobox row|label=[[minecraft:Flammable|Flammable]]|field={{ #if: {{{flammable|}}} | {{{flammable}}} | ?{{#if: {{NAMESPACE}} || {{translation category|project=0|Missing flammability}}}} }} }}
--->|pick|pickaxe=[[File:Use-pickaxe.png]]<!--
{{infobox row|label=Catches fire from [https://minecraft.wiki/w/Lava Lava]|field={{ #if: {{{lavasusceptible|}}} | {{{lavasusceptible}}} | ?{{#if: {{NAMESPACE}} || {{translation category|project=0|Missing lava susceptibility}}}} }} }} }}
--->|spade|shovel=[[File:Use-spade.png]]<!--
{{#if: {{NAMESPACE}} ||
--->|axe=[[File:Use-axe.png]]<!--
{{translation category|project=0|{{
--->|hoe|ho=[[File:Use-hoe.png]]<!--
  #switch: {{lc: {{{renewable|}}} }}
--->|#default= }}
  | yes = Renewable resources
}}
  | no = Non-renewable resources
{{#switch:{{lc:{{{type}}}}}|fluid =
  | Resources with invalid renewability
{{Block/row|label=Speed of fluid movement:|field={{{fluidspeed|?}}}}}
}}}}
{{Block/row|label=Speed of walking through:|field={{{movespeed|?}}}}}
}}<noinclude>
}}
{{documentation}}
{{Block/row|label=Data value{{#if:{{{data2|}}}|s|}}|field={{{data|{{#if:{{{datadec|}}}|<!--
<!-- Put categories/interwiki on the documentation page -->
 
</noinclude>
The original data values setup, used if datadec is a field
 
---->{{{datadec|?}}} <sub>dec</sub> ({{{datahex|{{dec-hex|{{{datadec|0}}}}}}}} <sub>hex</sub>)|<!--
 
The new formatting
 
---->{{#if:{{{data1name|}}}|'''{{{data1name|}}}'''<br />| }}<!--
----><sub>dec:</sub> {{{data1|35}}} <sub>hex:</sub> {{dec-hex|{{{data1|35}}} }}<br /><!--
 
The optional second data value in the new formatting.
 
---->{{#if:{{{data2|}}}|<!--
------>{{#if:{{{data2name|}}}|'''{{{data2name|}}}'''<br />| }}<!--
------><sub>dec:</sub> {{{data2}}} <sub>hex:</sub> {{dec-hex|{{{data2}}} }}<!--
---->|}}<!--
-->}} }}} }}
</table>{{#if:{{{tool|}}}|[[Category:Pages that the Tool parameter]]}}<noinclude><!---
--->
==Documentation==
'''These usage notes will not be included in articles bearing this template.'''
 
This template provides a uniform design for block pages.
<pre>
{{Block
| name =  
| image =
| type =
| gravity =  
| dirt =  
| transparent =
| light =
| Tool =
| datadec =
| datahex =
}}</pre>
 
{| class=grid
! Parameter
! Function
! Default value
|-
| <code>name</code> || Name of the block || <code><nowiki>{{BASEPAGENAME}}</nowiki></code>
|-
| <code>image</code> || Image of the block (should be approx. 150x150px) || [[:File:No image.png|No image.png]]
|-
| <code>type</code> || Type(solid block, solid, block, or fluid) || ?
|-
| <code>gravity</code> || Affected by gravity? || ?
|-
| <code>dirt</code> || Requires sunlight/dirt? || ?
|-
| <code>transparent</code> || Allows light to pass through? || ?
|-
| <code>light</code> || Emits Light? || ?
|-
| <code>tool</code> || Tool to use || ?
|-
| <code>datadec</code> || Decimal Data Value || ?
|-
| <code>datahex</code> || Hexadecimal Data Value || ?
|-
| <code>data</code> || Data Value (overrides dec and hex values) || <code>datadec</code> and <code>datahex</code>
|}
[[Category:Templates]]</noinclude>
<includeonly>{{#ifeq:{{NAMESPACE}}|{{ns:0}}|[[Category:Blocks]]}}</includeonly>