Extension:OreDict
OreDict Release status: stable |
|
---|---|
Implementation | Parser function , User rights , Special page , API , Hook , Database |
Description | An extension that mimics the ore dictionary in Minecraft. |
Author(s) |
|
Latest version | 3.4.1 (2024-03-23) |
MediaWiki | |
Tables | ext_oredict_items |
License | MIT License |
Download | GitHub:
<translate> Note:</translate> README.md CHANGELOG.md |
editoredict importoredict |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The OreDict extension mimics the Minecraft Forge OreDictionary, and later the item tag system native to Minecraft, using tag names, mod abbreviations, and item names. This is extension uses features from the Tilesheets extension. It was developed for use on the Feed The Beast Wiki.
Setup: Template:G/Cell
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:
- Template:G/Cell on the Feed The Beast Wiki (and its Scribunto module)
- Template:G/O on the Feed The Beast Wiki (used as a template interface into the #dict parser function) (and its Scribunto module)
Parser functions
#dict
The #dict
parser function displays all tiles (from the Tilesheets extension) registered to the specified OreDict tag.
Parameters
- 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 implementation of the OreDictOutput hook in the Tilesheets extension.
#grid_foreach
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
ImportOreDict
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.
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
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
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
This has all of the same parameters as the creation page, though its tag name and entry ID cannot be edited.
OreDictList
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
The OreDict extensions provides MediaWiki API action modules for interacting with the extension. The parameters are prefixed with od.
action=neworedict
Creates a new OreDict entry.
Parameters
- 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
- neworedict
- result: New entry's ID
- neworedict
Possible errors
- permissiondenied: User does not have editoredict permission.
- entryexists: The entry for item, tag, and mod already exists.
action=deleteoredict
Deletes an OreDict entry from the table by its ID.
Parameters
- ids (Integer, separate with "|", minimum value is "1"): (Required) A list of entry IDs to delete.
- token (csrf)
Returns
- edit
- deleteoredict
- entry ID => deletion success (boolean)
- entry ID => deletion success (boolean)
- ...
- deleteoredict
Possible errors
- permissiondenied: User does not have the editoredict permission.
action=editoredict
Updates the mod, tag, name, and/or params for a given entry.
Parameters
- 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
- editoredict
- entry ID => true
- editoredict
Possible errors
- 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
Get OreDict entry data.
Parameters
- ids (Integer, separate with "|", minimum value is "1"): (Required) The IDs for the entries to obtain information for.
Returns
- 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
- entry ID
- oredictentries
Possible errors
There are no errors for this module.
action=query&list=oredictsearch
Searches for OreDict entries that meet specific criteria defined by the optional parameters.
Parameters
- 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
- 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
There are no errors for this module.
References
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- Parser function extensions
- User rights extensions
- Special page extensions
- API extensions
- Hook extensions
- Database extensions
- Extensions without a compatibility policy
- Extensions without MediaWiki version
- MIT licensed extensions
- Extensions in GitHub version control
- Extensions which add rights
- ParserFirstCallInit extensions
- LoadExtensionSchemaUpdates extensions
- All extensions
- Extensions not in ExtensionJson