Template:Grid/doc: Difference between revisions

mNo edit summary
m (→‎Titles and description: changed picture text to match the description above it)
 
Line 72: Line 72:
<code><nowiki>{{Grid|Raw Porkchop; Cooked Porkchop|title=Smelly Pork}}</nowiki></code>
<code><nowiki>{{Grid|Raw Porkchop; Cooked Porkchop|title=Smelly Pork}}</nowiki></code>
;shows
;shows
{{Grid|Raw Porkchop; Cooked Porkchop|title=Smelly Porkchop}}
{{Grid|Raw Porkchop; Cooked Porkchop|title=Smelly Pork}}





Latest revision as of 11:59, 6 November 2023

This is the documentation page, it should be transcluded into the main template page. See Template:Documentation for more information
This template uses Module:Grid, with data stored in Module:Grid/Aliases.
These scripts are written in Lua. Please see wp:Lua and mw:Extension:Scribunto to learn more.

The grid template is a singular grid cell, which has the ability to display any image (usually a block or item) that is uploaded as Grid <Name>.png, within it.

Usage

All inputs are optional:

{{Grid
|[Title]Mod:Name,Amount[Description]; [Title2]Mod2:Name2,Amount2[Description2]
|mod=Default mod (useful for animations and layout templates)
|default=Image always shown under the main image
|align=Vertical Alignment
|link=Link override
|title=Text show on mouseover
|class=Adds additional classes to the .grid class
|style=Adds styling to the .grid
|imgclass=Adds additional classes to the .item
|numstyle=Adds styling to the number
}}

Parts

The first parameter is a special parameter consisting of various "parts" grouped together in frames (delimited by ;) which will be display one after another if JavaScript is enabled. Every part is optional, but without "name", won't do anything.

Simple example

To display this image File:Grid Raw Porkchop.png with an amount of 20 you would put: {{Grid|Raw Porkchop,20}}

shows

Raw Porkchop20

An amount of 2–999 is supported, anything else will not be displayed.

If no image is specified, the background will be added on its own, this could be used to do layouts like so:

{{Grid|TNT}}{{Grid|TNT}}{{Grid}}{{Grid}}{{Grid|TNT}}{{Grid|TNT}}<br>
{{Grid|TNT}}{{Grid|TNT}}{{Grid}}{{Grid}}{{Grid|TNT}}{{Grid|TNT}}<br>
{{Grid}}{{Grid}}{{Grid|TNT}}{{Grid|TNT}}{{Grid}}{{Grid}}<br>
{{Grid}}{{Grid|TNT}}{{Grid|TNT}}{{Grid|TNT}}{{Grid|TNT}}{{Grid}}<br>
{{Grid}}{{Grid|TNT}}{{Grid|TNT}}{{Grid|TNT}}{{Grid|TNT}}{{Grid}}<br>
{{Grid}}{{Grid|TNT}}{{Grid}}{{Grid}}{{Grid|TNT}}{{Grid}}
shows

TNTTNT

TNTTNT
TNTTNT

TNTTNT


TNTTNT



TNTTNTTNTTNT


TNTTNTTNTTNT


TNT

TNT

However this is really inefficient and produces ugly code, so don't do this. Use Template:BlockGrid or Template:Schematic instead.

Aliases

Note: Banner variations are not included due to how many there are.

The above aliases can be used to shorten common items, such as all wood blocks or adding parts to certain names by default.

{{Grid|Any Wood;Golden Apple}}

shows

Oak WoodSpruce WoodBirch WoodJungle WoodAcacia WoodDark Oak WoodGolden Apple


When using the alias, parts can be added which will override any parts in the alias.

{{Grid|Any Wood,4;[&oShiny Apple]Enchanted Golden Apple}}

shows

Oak Wood4Spruce Wood4Birch Wood4Jungle Wood4Acacia Wood4Dark Oak Wood4Shiny Apple


Mods can specify an additional aliases table using the modaliases parameter.

Titles and description

The title parameter can be used to set a title for all frames.

{{Grid|Raw Porkchop; Cooked Porkchop|title=Smelly Pork}}

shows

Smelly PorkSmelly Pork


To remove the title, set it to "none": {{Grid|Raw Porkchop; Cooked Porkchop|title=none}}

shows

Raw PorkchopCooked Porkchop


However, the first bracketed text can be used to specify a title for each frame individually, and also supports standard formatting codes using & instead of §. If the title only contains formatting codes and no actual text, the formatting will be added to the normal title.

{{Grid|[&b]Diamond Sword}}

shows

Diamond Sword


The last bracketed text can be used to specify a description, this also supports standard formatting codes, and can also have multiple lines by using forward slashes (/).

{{Grid|[&b&oExcalibur]Iron Sword[&7Smite V/Fire Aspect I//&9+6 Attack Damage]}}

shows

Excalibur

Align

Align uses the vertical-align CSS property. For example to align to the middle: Smells like {{Grid|Raw Porkchop|align=middle}} in here!

shows

Smells like Raw Porkchop in here!

Default

Default is always shown and is placed under the image. {{Grid|default=layout Brewing Empty}}{{Grid|Splash Mundane Potion|default=layout Brewing Empty}}

shows


Splash Mundane Potion

Link

To change the link for all frames from the image name put: {{Grid|Charcoal|link=Coal#Charcoal}}

shows

Charcoal


To remove the link, set link to none: {{Grid|Charcoal|link=none}}

shows

Charcoal

Note that this retains the title.

Available images

Other templates

These templates implement this template into a GUI screen which mimics how it would look in Minecraft. Thus, they have mostly the same features as this template.



Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Need wiki hosting?

Do you need a wiki for your Minecraft mod/gaming wiki? We'll host it for free! Contact us.

Other wikis

Indie-game wikis
Powered by Indie Wikis