Template:Infobox block/doc: Difference between revisions

Document the "includable" style of block pages, and why it makes sense to use them.
m interwiki JA
 
(99 intermediate revisions by 46 users not shown)
Line 1: Line 1:
{{doc/start}}
{{Documentation header}}
{{Block
{{Distinguish|Template:Blocks|Template:Blocked}}
|image=
 
|image2=
|image3=
|invimage=
|invimage2=
|invimage3=
|invimage4=
|type=
|gravity=
|dirt=
|transparent=
|light=
|tntres=
|tool=
|stackable=
|data=
|fluidspeed=
|movespeed=
}}
This template provides a uniform design for block pages.
This template provides a uniform design for block pages.
<pre width="30px">
&lt;onlyinclue&gt;{{ {{{1|Block}}}
|image=
|image2=
|image3=
|invimage=
|invimage2=
|invimage3=
|invimage4=
|type=
|gravity=
|dirt=
|transparent=
|light=
|tntres=
|tool=
|stackable=
|data=
|fluidspeed=
|movespeed=
}}&lt;/onlyinclude&gt;</pre>


Please note the unusual markup at the beginning and end; copy it verbatim if you are creating a new block page. Also note that if the item has multiple data values, use <code><nowiki>|multipledata=</nowiki></code> instead of <code><nowiki>|data=</nowiki></code>. See below:
== Usage ==
<pre style="display: table;">
{{Block
| title =
| image =
<!-- Start Multiple mode -->  
| group =  
| 1-1 =
| 1-2 =
| 1-3 =
| group2 =
| 2-1 =
| 2-2 =
| 2-3 =
| group3 =
| 3-1 =
| 3-2 =
| 3-3 =
| group4 =
| 4-1 =
| 4-2 =
| 4-3 =
<!-- End Multiple mode -->
| rarity =
| renewable =
| stackable =
| tool =
| tool2 =
| tool3 =
| tntres = <!--Typically not used in mainspace articles, as it is loaded from Module:Blast resistance values-->
| hardness = <!--Typically not used in mainspace articles, as it is loaded from Module:Hardness values-->
| durability =
| light =
| transparent =
| flammable =
| lavasusceptible =
}}</pre>


{| class=grid style="background-color: transparent;"
=== Parameters ===
{| class="wikitable"
! Parameter
! Parameter
! Function
! Function
! Default value
! Default value
|-
|-
| <code>name</code> || Only needed to change the name from the page name || <code><nowiki>{{BASEPAGENAME}}</nowiki></code>
| <code>title</code> || Only needed to change the title from the page name || <code><nowiki>{{BASEPAGENAME}}</nowiki></code>
|-
|-
| <code>image</code> || Image of the block (should be approx. 150x150px) || [[:File:No block image.png|No block image.png]]
| <code>image</code> || Image of the block (should be approx. 300×300px) || <code><nowiki>{{{title}}}.png</nowiki></code> if it exists, otherwise [[:File:No image.svg|No image.svg]] (linking to the page where to upload the missing image)
|-
|-
| <code>image2</code> || Second image for two-state blocks (also approx. 150x150px) || ''None''
| <code>image''N''</code> || Other images for two-state blocks (also approx. 300×300px) || ''None''
|-
|-
| <code>image3</code> || Third image for three-state blocks (also approx. 150x150px) || ''None''
| <code>rarity</code> || The color of this item's name. See [[rarity]] for more info. || ''None''
|-
|-
| <code>invimage</code> || Image for object in inventory (should be approx. 36x36px) || ''None''
| <code>renewable</code> || Whether the block is [[Renewable Resource|renewable]] || ?
|-
|-
| <code>invimage2</code> || Second image for two-state objects in inventory (should be approx. 36x36px) || ''None''
| <code>stackable</code> || Stackable || ?
|-
|-
| <code>invimage3</code> || Third image for three-state objects in inventory (should be approx. 36x36px) || ''None''
| <code>tool</code> || Tool to use. Picture means, the block can only be broken with this tool (this quality or better). Outline means, the block can be broken with any tool, but this tool is the quickest. "Any tool" means that every tool is equally effective (or the block can be instantly broken with anything). "None" means the block cannot be broken. || ?
|-
|-
| <code>invimage4</code> || Fourth image for four-state objects in inventory (should be approx. 36x36px) || ''None''
| <code>tool2</code> || Second tool that can be used, same format than the tool field. || ?
|-
|-
| <code>type</code> || Type (solid block, solid, block, or fluid) || ?
| <code>tool3</code> || Third tool that can be used, same format than the tool field. || ?
|-
|-
| <code>gravity</code> || Affected by gravity? || ?
| <code>tntres</code> || Block's resistance to explosions. The value comes from the code; there aren't any units for it. The value should normally be defined in [[Module:Blast resistance values]], otherwise, the page may result in an error and be placed in [[:Category:Pages with overridden tntres]]. || ?
|-
|-
| <code>dirt</code> || Requires sunlight/dirt? || ''None''
| <code>hardness</code> || Block's resistance to being broken. The value comes from the code; there aren't any units for it. The value should normally be defined in [[Module:Hardness values]], otherwise, the page may result in an error and be placed in [[:Category:Pages with overridden hardness]]. || ?
|-
|-
| <code>transparent</code> || Allows light to pass through? || ?
| <code>durability</code> || Hardness value in ''Minecraft Earth'' || ?
|-
|-
| <code>light</code> || Emits Light? || ?
| <code>light</code> || Emits Light? If "Yes," add the light value like this: "Yes (9)" || ?
|-
|-
| <code>tntres</code> || '''Do not use''', except for special cases.<br>Update the value in [[Template:Blast Resistance Values]] instead. || ?
| <code>transparent</code> || Can you see through some part of this block? Not as obvious as it seems, see [[Opacity]]. || ?
|-
|-
| <code>tool</code> || Tool to use || ?
| <code>heals</code> || Amount of hunger points restored || ''None''
|-
|-
| <code>stackable</code> || Stackable || N/A
| <code>flammable</code> || Whether the block is flammable or not. If so, the flammability value is included. || Unspecified
|-
|-
| <code>data</code> || Single decimal data value || ''None''
| <code>lavasusceptible</code> || Whether the block catches fire from nearby [[lava]]. Not always the same as flammable. || Unspecified
|-
|-
| <code>multipledata</code> || Multiple decimal data values, use {{tl|dv}} || ''None''
! Parameter (multiple mode only)
|-
! Function
| <code>fluidspeed</code> || Speed of fluid movement || ''None''
! Default/Example value
|-
| <code>movespeed</code> || Speed of walking through || ''None''
|}
 
== Transcluding block pages ==
 
The unusual header <code><nowiki>&lt;onlyinclude&gt;{{ {{{1|Block}}}</nowiki></code> and footer are there so that block pages can be transcluded (used like templates) into other pages. Specifically, this allows the use of {{tl|Safe get}} to get specific data fields out of the infobox header in the block page. Here's some examples:
 
{| class="wikitable"
! Code
! Result
|-
|-
| <code><nowiki>{{Safe get|Cobblestone|tntres}}</nowiki></code>
| {{cd|group}} || Group (tab) under which to put the image || ''None''
| {{Safe get|Cobblestone|tntres}}
|-
|-
| <code><nowiki>{{Safe get|Cobblestone|tool}}</nowiki></code>
| {{cd|group''N''}} || Other tabs present || ''None''
| {{Safe get|Cobblestone|tool}}
|-
|-
| <code><nowiki>[[File:{{Safe get|Cobblestone|image}}]]</nowiki></code>
| {{cd|1-''n''}} || ''n''th image under the first (default) tab || ''None''
| [[File:{{Safe get|Cobblestone|image}}]]
|-
|-
| <code><nowiki>{{Safe get|Cobblestone|non-existing field}}</nowiki></code>
| {{cd|''N''-''n''}} || ''n''th image under the ''N''th tab || ''None''
| {{Safe get|Cobblestone|non-existing field}}
|-
| <code><nowiki>{{Safe get|Main Page|tntres}}</nowiki></code>
| {{Safe get|Main Page|tntres}}
|}
|}


Although transcluding non-template pages is somewhat unusual, doing it this way allows all the data properties for a block to be defined in the infobox header, next to each other, and right where most people will think to look for them. At the same time, it allows us to make tables of values for things like [[Explosion#Blast_Resistance|Blast Resistance]] and [[Digging#Blocks_by_hardness|Hardness]] that auto-update whenever the main values are changed.
== See also ==
{{Infobox see also}}
 
<includeonly>
<!-- template categories/interwikis here -->
[[cs:Šablona:Block]]
[[de:Vorlage:Block]]
[[el:Πρότυπο:Block]]
[[es:Plantilla:Bloque]]
[[fr:Modèle:Bloc]]
[[hu:Sablon:Block]]
[[it:Template:Blocco]]
[[ja:テンプレート:Infobox block]]
[[ko:틀:Block]]
[[nl:Sjabloon:Blok]]
[[pl:Szablon:Blok]]
[[pt:Predefinição:Bloco]]
[[ru:Шаблон:Блок]]
[[th:แม่แบบ:Block]]
[[tr:Şablon:Block]]
[[uk:Шаблон:Блок]]
[[zh:Template:Block]]


See {{tl|Blast Resistance Table}} for a simple example of how to use this functionality to automatically build tables.
[[Category:Infobox templates]]
</includeonly>


== See also ==
<noinclude>
{{Infobox see also}}
<!-- doc categories/interwikis here -->
{{doc/end}}
[[cs:Šablona:Block/doc]]
[[de:Vorlage:Block/Dokumentation]]
[[el:Πρότυπο:Block/doc]]
[[es:Plantilla:Bloque/doc]]
[[fr:Modèle:Bloc/doc]]
[[hu:Sablon:Block/doc]]
[[it:Template:Blocco/doc]]
[[ja:テンプレート:Infobox block/doc]]
[[ko:틀:Block/doc]]
[[nl:Sjabloon:Blok/doc]]
[[pl:Szablon:Blok/doc]]
[[pt:Predefinição:Bloco/doc]]
[[ru:Шаблон:Блок/док]]
[[th:แม่แบบ:Block/doc]]
[[tr:Şablon:Block/doc]]
[[uk:Шаблон:Блок/док]]
[[zh:Template:Block/doc]]
</noinclude>
<templatedata>
{
"params": {
"title": {
"label": "Name",
"description": "Name of the block, if different from the page name.",
"type": "string"
},
"image": {
"label": "Image",
"description": "Image of the block. Defaults to using the page name as a filename.",
"type": "wiki-file-name",
"suggested": true
},
"invimage": {
"label": "Inventory image",
"description": "The image of what the block looks like as an item in the inventory.",
"type": "wiki-file-name"
},
"rarity": {
"label": "Block rarity",
"description": "The rarity of the block, which will show a special color in chat when in the inventory and in chat.",
"example": "rare",
"type": "string"
},
"renewable": {
"label": "Renewability",
"description": "If this block is renewable or not.",
"example": "No",
"type": "boolean",
"autovalue": "",
"suggested": true
},
"stackable": {
"label": "Stackability",
"description": "Whether or not this item can be stacked.",
"example": "Yes",
"type": "boolean",
"autovalue": "No",
"suggested": true
},
"tool": {
"label": "Tool",
"description": "Tool required to use without destroying the block.",
"example": "stone pickaxe",
"type": "string",
"suggested": true
},
"tool2": {
"label": "Secondary tool",
"description": "A secondary tool that can be used.",
"example": "hoe",
"type": "string"
},
"tntres": {
"label": "TNT resistance",
"description": "The amount of resistance to explosions this block has.",
"example": "25",
"type": "number",
"suggested": true
},
"hardness": {
"label": "Hardness",
"description": "The block's resistance to being broken.",
"example": "4",
"type": "number",
"suggested": true
},
"light": {
"label": "Emissive",
"description": "If this block emits light.",
"type": "unknown",
"autovalue": "Yes"
},
"transparent": {
"label": "Transparency",
"description": "If yes, this block is transparent.",
"example": "Yes",
"autovalue": "Yes"
},
"flammable": {
"label": "Flammability",
"description": "If yes, this block can be lit on fire.",
"example": "Yes",
"autovalue": "Yes"
},
"lavasusceptible": {
"label": "Lava susceptibility",
"description": "If yes, this block can catch fire from nearby lava.",
"example": "Yes",
"autovalue": "Yes"
},
"maxStack": {
"label": "Maximum stack size",
"description": "The maximum number of items that can be combined into a single stack.",
"example": "64",
"type": "number"
            },
"durability": {
"label": "Durability",
"description": "The block's resistance to being broken (only in Minecraft Earth).",
"example": "39",
"type": "number",
"suggested": true
},
"lightLevel": {
"label": "Light level",
"description": "The amount of light emitted by this block (1-15), if any.",
"example": "15",
"type": "number",
"autovalue": ""
},
"tool3": {},
"waterloggable": {
"example": "Yes",
"default": "If yes, this block can be waterlogged"
}
},
"description": "An infobox for a block.",
"paramOrder": [
"title",
"image",
"invimage",
"rarity",
"renewable",
"stackable",
"maxStack",
"tool",
"tool2",
"tool3",
"tntres",
"hardness",
"light",
"lightLevel",
"transparent",
"waterloggable",
      "durability",
"flammable",
"lavasusceptible"
],
"format": "block"
}
</templatedata>