Feed The Beast Wiki

Follow the Feed The Beast Wiki on Discord or Mastodon!

READ MORE

Feed The Beast Wiki
(Added more examples)
(Update docs to include "size", "appendtitle", and "padding" args)
 
(18 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
{{Doc/Start}}
 
{{Doc/Start}}
  +
{{Lua|Grid}}
 
This template is the display logic for grids.
 
This template is the display logic for grids.
   
 
== Parameters ==
 
== Parameters ==
  +
All parameters are optional, except for <code>mod</code>.
 
* '''1''': The name of the item to display.
 
* '''1''': The name of the item to display.
* '''2''': The amount of the item to display.
+
* '''2''': ''(Default: 1)'' The amount of the item to display.
  +
* '''title''': Tooltip title override. See [[Template:Tooltip/doc]] for formatting information.
* '''tooltiptext''': ''(Optional)'' Modifies the tooltip when hovering over the cell. Variables are supported: <code>$1</code>: The item name. <code>$2</code>: The amount of items. <code>$3</code>: Full mod name.
 
  +
* '''desc''': Tooltip description override. See [[Template:Tooltip/doc]] for formatting information.
* '''tooltipclass''': ''(Optional)'' Adds a class to the tooltip.
 
* '''tooltipstyle''': ''(Optional)'' Adds additional styling to the tooltip.
+
* '''class''': Adds a class to the cell.
* '''class''': ''(Optional)'' Adds a class to the cell wrapper.
+
* '''align''': Change vertical-alignment of cell to surrounding text.
* '''imgclass''': ''(Optional)'' Adds a class to the image wrapper.
+
* '''padding''': Sets the padding of the grid icon; useful for the {{Tl|Effect}} template.
* '''no-bg''': ''(Optional)'' Disables the cell background.
+
* '''style''': Adds CSS styling to add to the cell.
* '''default''': ''(Optional)'' Displays a default grid image in the background.
+
* '''numstyle''': Adds CSS styling to the number.
* '''link''': ''(Optional)'' Changes the article that the cell will link to. Set to "none" to disable links.
+
* '''size''': ''(Default: 32)'' Sets the icon size to retrieve. If an invalid size is provided, the smallest size is used (usually 16).
  +
* '''no-bg''': Disables the cell background.
* '''mod''': ''(Optional)'' Sets the item mod, if not provided, an extension will attempt to find the correct image to display. You can use both the mod abbreviation as defined in [[Template:G/Mods]] or the full mod name.
 
  +
* '''appendtitle''': If set, turns the <code>title</code> arg into a string that is appended onto the localized item name. If you want a space between the localized name and the appended string, you must start with <code><nowiki &#x2F;></code> and then the space.
  +
* '''link''': Changes the article that the cell will link to. Set to "none" to disable links.
  +
* '''mod''': Sets the mod that the item comes from. You can use both the mod abbreviation as defined in [[Module:Mods/list]] or the full mod name. The mod abbreviation is recommended for standardization purposes.
  +
* '''dis''': By default, points to the disambiguated item name in the form <code>Item (Mod)</code>. Otherwise, if set to <code>false</code> or any other value, the link points directly to the item name.
   
 
== Usage ==
 
== Usage ==
  +
{{Tl|Gc}} is used to display items, for use in Crafting Grid templates ({{Tl|Cg}}) and Infobox templates ({{Tl|Infobox}}).
When creating grids, using the {{Tl|G}} template is recommended over using this template. But if you want to bypass the ore dictionary, you can use this template instead. {{Tl|Gc}} also acts as an shortcut to this template and should be used when creating grids in a crafting table.
 
  +
  +
Use {{Tl|Cg}} to display single items, or {{Tl|O}} if the crafting recipe uses Ore Dictionary tags to determine allowable items.
  +
  +
To display items inside ordinary page text or tables, use {{Tl|P}} or {{Tl|Pn}}.
  +
  +
For more information and examples, see the [[Project:CGG|Crafting Grid Guide]].
   
 
== Examples ==
 
== Examples ==
  +
{| class="wikitable"
=== Basic usage ===
 
  +
! Code !! Result !! Comment
<pre>
 
  +
|-
{{Gc|TNT|10}}
 
  +
| <pre>{{Gc|mod=V|dis=false|TNT|10}}</pre> || {{Gc|mod=V|dis=false|TNT|10}} || Normal usage
</pre>
 
  +
|}
produces:<br>
 
  +
{{Gc|TNT|10}}
 
  +
== History ==
  +
In the past, {{Tl|G}} was used to combine both {{Tl|G/Cell}} and {{Tl|G/O}} into one template (assisted by the now-removed {{Tl|G?}}), and was used all over the wiki. However, this is no longer the case; {{Tl|G}} had various issues associated with performance and incorrect displays. Therefore, all existing {{Tl|G}} usage was converted to {{Tl|G/Cell}}/{{Tl|G/O}}, and, with the creation of [[Module:Grid]], {{Tl|G}} was fully removed and now redirects to {{Tl|G/Cell}}.
   
=== Tooltips ===
 
<pre>
 
{{Gc|Copper Ingot|mod=TE|4|tooltiptext=$2 $1s<br/>($3)|tooltipstyle=color:#FF5;|link=Thermal Expansion}}
 
</pre>
 
produces:<br>
 
{{Gc|Copper Ingot|mod=TE|4|tooltiptext=$2 $1s<br/>($3)|tooltipstyle=color:#FF5;|link=Thermal Expansion}}
 
 
{{TC|Grid templates}}
 
{{TC|Grid templates}}
 
{{Doc/End|Template:G/Cell/doc}}
 
{{Doc/End|Template:G/Cell/doc}}

Latest revision as of 23:52, 8 November 2020

Template-info Documentation
Lua logo This template uses Module:Grid, a script written in Lua.
Please see wikipedia:wp:Lua and mw:Extension:Scribunto to learn more.

This template is the display logic for grids.

Parameters

All parameters are optional, except for mod.

  • 1: The name of the item to display.
  • 2: (Default: 1) The amount of the item to display.
  • title: Tooltip title override. See Template:Tooltip/doc for formatting information.
  • desc: Tooltip description override. See Template:Tooltip/doc for formatting information.
  • class: Adds a class to the cell.
  • align: Change vertical-alignment of cell to surrounding text.
  • padding: Sets the padding of the grid icon; useful for the {{Effect}} template.
  • style: Adds CSS styling to add to the cell.
  • numstyle: Adds CSS styling to the number.
  • size: (Default: 32) Sets the icon size to retrieve. If an invalid size is provided, the smallest size is used (usually 16).
  • no-bg: Disables the cell background.
  • appendtitle: If set, turns the title arg into a string that is appended onto the localized item name. If you want a space between the localized name and the appended string, you must start with <nowiki /> and then the space.
  • link: Changes the article that the cell will link to. Set to "none" to disable links.
  • mod: Sets the mod that the item comes from. You can use both the mod abbreviation as defined in Module:Mods/list or the full mod name. The mod abbreviation is recommended for standardization purposes.
  • dis: By default, points to the disambiguated item name in the form Item (Mod). Otherwise, if set to false or any other value, the link points directly to the item name.

Usage

{{Gc}} is used to display items, for use in Crafting Grid templates ({{Cg}}) and Infobox templates ({{Infobox}}).

Use {{Cg}} to display single items, or {{O}} if the crafting recipe uses Ore Dictionary tags to determine allowable items.

To display items inside ordinary page text or tables, use {{P}} or {{Pn}}.

For more information and examples, see the Crafting Grid Guide.

Examples

Code Result Comment
{{Gc|mod=V|dis=false|TNT|10}}

10
Normal usage

History

In the past, {{G}} was used to combine both {{G/Cell}} and {{G/O}} into one template (assisted by the now-removed {{G?}}), and was used all over the wiki. However, this is no longer the case; {{G}} had various issues associated with performance and incorrect displays. Therefore, all existing {{G}} usage was converted to {{G/Cell}}/{{G/O}}, and, with the creation of Module:Grid, {{G}} was fully removed and now redirects to {{G/Cell}}.


This is the documentation page, it should be transcluded into the main template page. See Template:Doc for more information.