Extension:OreDict

From Gamepedia Help Wiki
Jump to: navigation, search
OreDict
Version 3.3.1
Author(s) Jinbobo
Telshin
Retep998
Eli Foster
noahm
applehat
Extension link GitHub
Requirements Tilesheets
Description
An extension that mimics the ore dictionary in Minecraft.

The OreDict extension mimics the Minecraft Forge OreDictionary using tag names, mod abbreviations, and item names. This is extension uses a lot of the features from the Tilesheets extension, making them go hand-in-hand.

Setup: Template:G/Cell[edit | edit source]

This extension, with Tilesheets, requires a template called {{G/Cell}} for the logic of rendering OreDict entries as grid icons. The arguments passed to the parser function will be passed on to the template, along with the default grid parameters of the entry, the tag name (parameter name "ore-dict-name"), mod name ("mod"). The item name will also be passed to the template, as the first numbered parameter. For example: If you call {{#dict:logWood|templateparam=true}}, with an entry at logWood!Oak Wood Log!V!link=Different Page (see ImportOreDict), this will in turn call {{G/Cell|logWood|templateparam=true|ore-dict-name=logWood|mod=V|link=Different Page}}.

For an example of how to set up G/Cell, see:

Parser functions[edit | edit source]

#dict[edit | edit source]

The #dict parser function displays all tiles (from the Tilesheets extension) registered to the specified OreDict tag.

Parameters[edit | edit source]

  • 1: The tag or item name to select by.
  • tag: Set to specify that it is being selected by tag name.
If this is not set, it will search for entries whose name — not tag — matches the first parameter. It will display multiple OreDict entries that match the same item and mod pairs but have different tag names.
  • mod: Set to a mod abbreviation to include only entries in this mod.
  • no-fallback: Set to prevent the fallback icon from showing for missing OreDict entries. This does not suppress OreDict entries from showing error tiles entirely. For example, calling #dict with ingotIron and this option set when there is no registered ingotIron OreDict entry would return nothing. However, if there was an entry at ingotIron pointing to Iron Ingot from V, but that tile itself did not exist, it would return the error icon.

Any other parameters will be passed directly to the {{G/Cell}} template through the OreDictOutput hook in the Tilesheets extension.

#grid_foreach[edit | edit source]

The #grid_foreach parser function displays the same output as #dict, except for many different OreDict entries. The parameters are all the same, except they are separated by ! instead of |, while | separates each entry. For example, {{#grid_foreach:ingotIron!mod=V|logWood!mod=V}} would output the #dict output for ingotIron followed by the output for logWood.

The #grid_foreach also takes "global parameters", in order to reduce duplicate parameters. These are passed using arrow keysets, key=>value, separated by pipes |. With the previous example, it could be shortened by writing {{#grid_foreach:mod=>V|ingotIron|logWood}}, because all of the entries used "V" as the mod.

Special pages[edit | edit source]

ImportOreDict[edit | edit source]

The ImportOreDict special page is used to import OreDict entries in bulk. Each parameter is separated by a !, and each entry is separated by a newline. There are five parameters for each entry, two of which can be left blank.

Parameter Description Required
tagName The tag name that is used to call all items of that OreDict entry. Yes
itemName The name of the item as defined with the Tilesheets extension. Yes
modName The abbreviation of the mod as defined with the Tilesheets extension. Yes
gridParams Default arguments to be passed to the {{G/Cell}} template for this entry. For example, "link=Different Page". This parameter is planned to be replaced; it is generally advised to not use it until replaced.[1] No

An example import line is: logWood!Oak Wood Log!V!.

OreDictEntryManager[edit | edit source]

OreDictEntryManager is used to edit a single OreDict entry's values, create a single OreDict entry, or delete an entry, with an intuitive graphic user interface.

The initial special page only has a single search field and two buttons: Go and Create new entry. Go will find the entry at the ID that you have defined in the search field, and take you to its modification page. This field only takes integer values. Create new entry will redirect you to the entry creation page.

Entry creation[edit | edit source]

On this page, there are 5 new fields. Many of these are associated with various entry flag values.

Field name Description Required
Entry ID The entry ID that is given to the entry. This cannot be changed, and is handled entirely by the extension. It displays as "-1". -
Ore dictionary tag name The desired tag name for the entry. This is what will be used to call all items of that tag. Yes
Item name The name of the item, defined with the Tilesheets extension. Yes
Abbreviated mod name The abbreviated mod name defined with the Tilesheets extension. Yes
Default grid parameters Default arguments to be passed to the {{G/Cell}} template for this entry. For example, "link=Different Page". This parameter is planned to be replaced; it is generally advised to not use it until replaced.[1] No

Entry modification[edit | edit source]

This has all of the same parameters as the creation page, though its tag name is locked at the given ID's tag name, and its values are defaulted to the ones provided by that ID.

OreDictList[edit | edit source]

This lists all OreDict entries on a given wiki. It can be searched with entry IDs, prefixes, tag names, mod names, and the amount shown per page can be changed. It displays the entry in a table, with the ID, the tag name, item name, mod name, and default grid parameters. There is also an edit button that will take you to the entry manager modification page for that given entry.

API[edit | edit source]

The OreDict extensions provides MediaWiki API action modules for interacting with the extension. The parameters are prefixed with od.

action=neworedict[edit | edit source]

Creates a new OreDict entry.

Parameters[edit | edit source]

  • mod (String): (Required) The mod abbreviation for the new entry.
  • tag (String): (Required) The tag name for the new entry.
  • item (String): (Required) The item name for the new entry.
  • params (String): (Optional) The grid parameters for the new entry.
  • token (csrf)

Returns[edit | edit source]

  • edit
    • neworedict
      • result: New entry's ID

Possible errors[edit | edit source]

  • permissiondenied: User does not have editoredict permission.
  • entryexists: The entry for item, tag, and mod already exists.

action=deleteoredict[edit | edit source]

Deletes an OreDict entry from the table by its ID.

Parameters[edit | edit source]

  • ids (Integer, separate with "|", minimum value is "1"): (Required) A list of entry IDs to delete.
  • token (csrf)

Returns[edit | edit source]

  • edit
    • deleteoredict
      • entry ID => deletion success (boolean)
      • entry ID => deletion success (boolean)
      • ...

Possible errors[edit | edit source]

  • permissiondenied: User does not have the editoredict permission.

action=editoredict[edit | edit source]

Updates the mod, tag, name, and/or params for a given entry.

Parameters[edit | edit source]

  • mod (String): (Optional) The new mod abbreviation for the entry.
  • tag (String): (Optional) The new tag name for the entry.
  • item (String): (Optional) The new item name for the entry.
  • params (String): (Optional) The new grid parameters for the entry.
  • id (Integer, minimum value is "1"): (Required) The entry ID, to determine which entry to update.
  • token (csrf)

Returns[edit | edit source]

  • edit
    • editoredict
      • entry ID => true

Possible errors[edit | edit source]

  • dbfail: Failed to edit the ID in the database.
  • nodiff: There was no change made for the entry.
  • entrynotexists: There is no entry for the provided ID.
  • permissiondenied: User does not have the editoredict permission.

action=query&prop=oredictentry[edit | edit source]

Get OreDict entry data.

Parameters[edit | edit source]

  • ids (Integer, separate with "|", minimum value is "1"): (Required) The IDs for the entries to obtain information for.

Returns[edit | edit source]

  • query
    • oredictentries
      • entry ID
        • tag_name => The tag name for this ID
        • mod_name => The mod name for this ID
        • item_name => The item name for this ID
        • grid_params => The grid parameters for this ID
        • id => The entry ID

Possible errors[edit | edit source]

There are no errors for this module.

action=query&list=oredictsearch[edit | edit source]

Searches for OreDict entries that meet specific criteria defined by the optional parameters.

Parameters[edit | edit source]

  • limit (Limit, minimum value is "1", maximum for users is "500", maximum for bots is "5000"): (Defaults to 10) The maximum number of entries to list.
  • prefix (String): (Defaults to "") Restricts results to those that have a tag alphabetically after the prefix.
  • mod (String): (Defaults to "") Restricts results to this mod.
  • tag (String): (Defaults to "") Restricts results to this tag name.
  • name (String): (Defaults to "") Restricts results to this item name.
  • from (Integer, minimum value is "0"): (Defaults to "0") The entry ID to start listing at.

Returns[edit | edit source]

  • query
    • totalhits => The number of entries returned
    • oredictentries
      • tag_name => The tag name for this ID
      • mod_name => The mod name for this ID
      • item_name => The item name for this ID
      • grid_params => The grid parameters for this ID
      • id => The entry ID

Possible errors[edit | edit source]

There are no errors for this module.

References[edit | edit source]