Difference between revisions of "Template:I-slot"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<span class="minetip invslot-item" {{#if: {{{minetip-title|}}}|data-minetip-title="{{{minetip-title|{{{name}}}}}}" }} {{#if: {{{minetip-text|}}}|data-minetip-text="{{{minetip-text|}}}"}}>[[File:{{{name|Invisible-sprite}}}.png|{{{size|16}}}x{{{size|16}}}px|class=item-icon pixel {{{class|}}}|link={{{item-link|{{{name}}}}}}|{{{tooltip|{{{name}}}}}}]]</span><noinclude>
+
<span class="invslot-item" {{#if: {{{minetip-title|}}}|data-minetip-title="{{{minetip-title|{{{name}}}}}}"}} {{#if: {{{minetip-text|}}}|data-minetip-text="{{{minetip-text|}}}"}}>[[File:{{{name|Invisible-sprite}}}.png|{{{size|16}}}x{{{size|16}}}px|class=item-icon pixel {{{class|}}}|link={{{item-link|{{{name}}}}}}|{{{tooltip|{{{name}}}}}}]]{{#if: {{{amount|}}}|<span class="item-amount">{{{amount|}}}</span>}}{{#if: {{{durability|}}}|<span class="item-durability" data-durability="{{{durability|}}}"></span>}}</span><noinclude>
 
== About ==
 
== About ==
 
This templated (named '''I-slot''' as a shortcut for '''item-slot''') serves as an easy method to add icon sprites that are inside of a in-game slot, with tooltip included with the item's name and/or with extra info.
 
This templated (named '''I-slot''' as a shortcut for '''item-slot''') serves as an easy method to add icon sprites that are inside of a in-game slot, with tooltip included with the item's name and/or with extra info.
Line 7: Line 7:
 
<pre><nowiki>
 
<pre><nowiki>
 
{{I-slot
 
{{I-slot
|name = <file-name>
+
  | name = <file-name>
|link = <item-link>
+
  | amount = <number>
|size = <file-size> (width and height at the same time)
+
  | durability = <number>
|class = <file-class>
+
  | link = <item-link>
|tooltip = <default-tooltip-text>
+
  | size = <file-size> (width and height at the same time)
|tooltip-title = <mb-tooltip-title>
+
  | class = <file-class>
|tooltip-text = <mb-tooltip-text>
+
  | tooltip = <default-tooltip-text>
 +
  | minetip-title = <mb-minetip-title>
 +
  | minetip-text = <mb-minetip-text>
 
}}
 
}}
</nowiki></pre>. Note tht <code>tooltip-title</code> and <code>tooltip-text</code> are mandatory for the tooltip to work. In case you don't need <code>tooltip-text</code>, you can mention the parameter and leave it empty. <code>tooltip-title</code> defaults to the first parameter (<code>file-name</code>)'s text if it's not used.
+
</nowiki></pre>
 +
 
 +
The single line version is:
 +
 
 +
<pre><nowiki>
 +
{{I-slot|name= <file-name>|amount= <number>|durability= <number>|link= <item-link>|size= <file-size> (width and height at the same time)|class= <file-class>|tooltip= <default-tooltip-text>|minetip-title= <mb-minetip-title>|minetip-text= <mb-minetip-text>}}
 +
</nowiki></pre>
 +
 
 +
Note that <code>minetip-title</code> and <code>minetip-text</code> are mandatory for the tooltip to work. In case you don't need <code>minetip-text</code>, you can mention the parameter and leave it empty. <code>minetip-title</code> defaults to the first parameter (<code>file-name</code>)'s text if it's not used.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 27: Line 37:
 
| It's the item's name. It's mainly used for the image name. No format is needed to specify.
 
| It's the item's name. It's mainly used for the image name. No format is needed to specify.
 
| String
 
| String
| Invisible-sprite
+
| <code>Invisible-sprite</code>
 
| Recommended
 
| Recommended
 +
|-
 +
! <code>amount</code>
 +
| Number of the same item.
 +
| Integer
 +
| None
 +
| Optional
 +
|-
 +
! <code>durability</code>
 +
| Amount of durability of the item, expressed in percentages multiples of 10.
 +
| Integer
 +
| None
 +
| Optional
 
|-
 
|-
 
! <code>link</code>
 
! <code>link</code>
Line 39: Line 61:
 
| Icon's size (both width and height share the same value to keep the image fully squared).
 
| Icon's size (both width and height share the same value to keep the image fully squared).
 
| Integer
 
| Integer
| 16
+
| <code>16</code>
 
| Optional
 
| Optional
 
|-
 
|-
Line 54: Line 76:
 
| Optional
 
| Optional
 
|-
 
|-
! <code>tooltip-title</code>
+
! <code>minetip-title</code>
 
| Icon's Mine Block tooltip title.
 
| Icon's Mine Block tooltip title.
 
| String
 
| String
Line 60: Line 82:
 
| Optional
 
| Optional
 
|-
 
|-
! <code>tooltip-text</code>
+
! <code>minetip-text</code>
 
| Icon's Mine Block tooltip text. Use the forward slash (<code>/</code>) as line breaks.
 
| Icon's Mine Block tooltip text. Use the forward slash (<code>/</code>) as line breaks.
 
| String
 
| String
 
| None
 
| None
| Optional.<br>Mandatory if <code>tooltip-title</code> is being used
+
| Optional
 
|}
 
|}
  
 
== Examples ==
 
== Examples ==
* Name: <code><nowiki>{{I-slot|name=Wooden Planks}}</nowiki></code> {{I-slot|name=Wooden Planks}}
+
{| class="wikitable"
* Name and link: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow}}
+
! width="200"| Values used
* Name, link, and size: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24}}
+
! Code
* Name, link, size, and icon class: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class}}
+
! Result
* Name, link, size, icon class, and default tooltip text: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.}}
+
|-
* Name, link, size, icon class, default tooltip text, and empty mb tooltip title: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=}}
+
| Name
* Name, link, size, icon class, default tooltip text, and mb tooltip title with custom text: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=Lorem ipsum}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=Lorem ipsum}}
+
|
* Name, link, size, icon class, default tooltip text, and empty mb tooltip text: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-text=}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-text=}}
+
<pre><nowiki>
* Name, link, size, icon class, default tooltip text, and mb tooltip with custom text: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-text=Dolor sit amet.}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-text=Dolor sit amet.}}
+
{{I-slot
* Name, link, size, icon class, default tooltip text, mb tooltip title with custom text, and mb tooltip with custom text: <code><nowiki>{{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=Lorem ipsum|tooltip-text=Dolor sit amet.}}</nowiki></code> {{I-slot|name=Wooden Planks|link=Cow|size=24|class=thumb-class|tooltip=Default tooltip text.|tooltip-title=Lorem ipsum|tooltip-text=Dolor sit amet.}}
+
  | name = Wooden Planks
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks}}
 +
|-
 +
| Name and amount
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
}}
 +
|-
 +
| Name, amount, and durability
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 0
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 0
 +
}}
 +
|-
 +
| Name, amount, durability and link
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 10
 +
  | link = Cow
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 10
 +
  | link = Cow
 +
}}
 +
|-
 +
| Name, amount, durability, link, and size
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 20
 +
  | link = Cow
 +
  | size = 24
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 20
 +
  | link = Cow
 +
  | size = 24
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, and icon class
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 30
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 30
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, and default tooltip text
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 40
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
}}</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 40
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, default tooltip text, and empty mb tooltip title
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 50
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title =
 +
}}</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 50
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title =
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, default tooltip text, and mb tooltip title with custom text
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 60
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title = Lorem Ipsum
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 60
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title = Lorem Ipsum
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, default tooltip text, and empty mb tooltip text
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 70
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-text =
 +
}}
 +
</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 70
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-text =
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, default tooltip text, and mb tooltip with custom text
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 80
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-text = Dolor sit amet.
 +
}}</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 80
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-text = Dolor sit amet.
 +
}}
 +
|-
 +
| Name, amount, durability, link, size, icon class, default tooltip text, mb tooltip title with custom text, and mb tooltip with custom text
 +
|
 +
<pre><nowiki>
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 90
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title = Lorem Ipsum
 +
  | minetip-text = Dolor sit amet.
 +
}}</nowiki></pre>
 +
|
 +
{{I-slot
 +
  | name = Wooden Planks
 +
  | amount = 64
 +
  | durability = 90
 +
  | link = Cow
 +
  | size = 24
 +
  | class = thumb-class
 +
  | tooltip = Default tooltip text.
 +
  | minetip-title = Lorem Ipsum
 +
  | minetip-text = Dolor sit amet.
 +
}}
 +
|}
  
== Note ==
+
== Notes ==
Despite the default tooltip being removed if the custom mb tooltip is being used, it's recommended to also use it since it will display as a fallback in case the user has disabled their JavaScript.
+
* If a custom value for the icons' size is going to be used, it should be any of these: <code>16</code>, <code>18</code>, <code>20</code>, <code>22</code>, or <code>24</code>.
 +
** Using any other value will make the icon to not be centered.
 +
** Using a value higher than the ones mentioned above will make the icon overflow from its container box.
 +
* The values supported by the <code>durability</code> parameter are: <code>10</code>, <code>20</code>, <code>30</code>, <code>40</code>, <code>50</code>, <code>60</code>, <code>70</code>, <code>80</code>, <code>90</code>, and <code>100</code>.
 +
** Any other value will make the durability bar empty.
 +
* Despite the default tooltip being removed if the custom mb tooltip is being used, it's recommended to not remove it (using the parameter but leaving its value empty) since it will display as a fallback in case the user has disabled their JavaScript.
 
</noinclude>
 
</noinclude>

Latest revision as of 19:10, 18 December 2021

{{{name}}}

About

This templated (named I-slot as a shortcut for item-slot) serves as an easy method to add icon sprites that are inside of a in-game slot, with tooltip included with the item's name and/or with extra info.

Usage

The syntax of the template is:

{{I-slot
  | name = <file-name>
  | amount = <number>
  | durability = <number>
  | link = <item-link>
  | size = <file-size> (width and height at the same time)
  | class = <file-class>
  | tooltip = <default-tooltip-text>
  | minetip-title = <mb-minetip-title>
  | minetip-text = <mb-minetip-text>
}}

The single line version is:

{{I-slot|name= <file-name>|amount= <number>|durability= <number>|link= <item-link>|size= <file-size> (width and height at the same time)|class= <file-class>|tooltip= <default-tooltip-text>|minetip-title= <mb-minetip-title>|minetip-text= <mb-minetip-text>}}

Note that minetip-title and minetip-text are mandatory for the tooltip to work. In case you don't need minetip-text, you can mention the parameter and leave it empty. minetip-title defaults to the first parameter (file-name)'s text if it's not used.

Parameter Function Value type Default value Status
name It's the item's name. It's mainly used for the image name. No format is needed to specify. String Invisible-sprite Recommended
amount Number of the same item. Integer None Optional
durability Amount of durability of the item, expressed in percentages multiples of 10. Integer None Optional
link Icon's link. Wikitext name's value Optional
size Icon's size (both width and height share the same value to keep the image fully squared). Integer 16 Optional
class Icon's extra classes. String None Optional
tooltip Icon's default tooltip text. It's automatically removed if the Mine Blocks-themed tooltip isbeing used (see below). String name's value Optional
minetip-title Icon's Mine Block tooltip title. String name's value Optional
minetip-text Icon's Mine Block tooltip text. Use the forward slash (/) as line breaks. String None Optional

Examples

Values used Code Result
Name
{{I-slot
  | name = Wooden Planks
}}

Wooden Planks

Name and amount
{{I-slot
  | name = Wooden Planks
  | amount = 64
}}

Wooden Planks64

Name, amount, and durability
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 0
}}

Wooden Planks64

Name, amount, durability and link
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 10
  | link = Cow
}}

Wooden Planks64

Name, amount, durability, link, and size
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 20
  | link = Cow
  | size = 24
}}

Wooden Planks64

Name, amount, durability, link, size, and icon class
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 30
  | link = Cow
  | size = 24
  | class = thumb-class
}}

Wooden Planks64

Name, amount, durability, link, size, icon class, and default tooltip text
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 40
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
}}

Default tooltip text.64

Name, amount, durability, link, size, icon class, default tooltip text, and empty mb tooltip title
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 50
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
  | minetip-title =
}}

Default tooltip text.64

Name, amount, durability, link, size, icon class, default tooltip text, and mb tooltip title with custom text
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 60
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
  | minetip-title = Lorem Ipsum
}}

Default tooltip text.64

Name, amount, durability, link, size, icon class, default tooltip text, and empty mb tooltip text
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 70
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
  | minetip-text =
}}

Default tooltip text.64

Name, amount, durability, link, size, icon class, default tooltip text, and mb tooltip with custom text
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 80
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
  | minetip-text = Dolor sit amet.
}}

Default tooltip text.64

Name, amount, durability, link, size, icon class, default tooltip text, mb tooltip title with custom text, and mb tooltip with custom text
{{I-slot
  | name = Wooden Planks
  | amount = 64
  | durability = 90
  | link = Cow
  | size = 24
  | class = thumb-class
  | tooltip = Default tooltip text.
  | minetip-title = Lorem Ipsum
  | minetip-text = Dolor sit amet.
}}

Default tooltip text.64

Notes

  • If a custom value for the icons' size is going to be used, it should be any of these: 16, 18, 20, 22, or 24.
    • Using any other value will make the icon to not be centered.
    • Using a value higher than the ones mentioned above will make the icon overflow from its container box.
  • The values supported by the durability parameter are: 10, 20, 30, 40, 50, 60, 70, 80, 90, and 100.
    • Any other value will make the durability bar empty.
  • Despite the default tooltip being removed if the custom mb tooltip is being used, it's recommended to not remove it (using the parameter but leaving its value empty) since it will display as a fallback in case the user has disabled their JavaScript.