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.2 (2024-08-07) |
MediaWiki | |
Tables | ext_oredict_items |
License | MIT License |
Download | GitHub: Note: README.md CHANGELOG.md |
editoredict importoredict |
|
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
[edit]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
[edit]#dict
[edit]The #dict
parser function displays all tiles (from the Tilesheets extension) registered to the specified OreDict tag.
Parameters
[edit]- 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
[edit]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]ImportOreDict
[edit]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
[edit]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]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]This has all of the same parameters as the creation page, though its tag name and entry ID cannot be edited.
OreDictList
[edit]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]The OreDict extensions provides MediaWiki API action modules for interacting with the extension. The parameters are prefixed with od.
action=neworedict
[edit]Creates a new OreDict entry.
Parameters
[edit]- 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
- neworedict
- result: New entry's ID
- neworedict
Possible errors
[edit]- permissiondenied: User does not have editoredict permission.
- entryexists: The entry for item, tag, and mod already exists.
action=deleteoredict
[edit]Deletes an OreDict entry from the table by its ID.
Parameters
[edit]- ids (Integer, separate with "|", minimum value is "1"): (Required) A list of entry IDs to delete.
- token (csrf)
Returns
[edit]- edit
- deleteoredict
- entry ID => deletion success (boolean)
- entry ID => deletion success (boolean)
- ...
- deleteoredict
Possible errors
[edit]- permissiondenied: User does not have the editoredict permission.
action=editoredict
[edit]Updates the mod, tag, name, and/or params for a given entry.
Parameters
[edit]- 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
- editoredict
- entry ID => true
- editoredict
Possible errors
[edit]- 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]Get OreDict entry data.
Parameters
[edit]- ids (Integer, separate with "|", minimum value is "1"): (Required) The IDs for the entries to obtain information for.
Returns
[edit]- 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
[edit]There are no errors for this module.
action=query&list=oredictsearch
[edit]Searches for OreDict entries that meet specific criteria defined by the optional parameters.
Parameters
[edit]- 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]- 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]There are no errors for this module.
References
[edit]This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Stable extensions
- Parser function extensions
- User rights extensions
- Special page extensions
- API extensions
- Hook extensions
- Database extensions
- MIT licensed extensions
- Extensions in GitHub version control
- Extensions which add rights
- ParserFirstCallInit extensions
- EditPage::showEditForm:initial extensions
- LoadExtensionSchemaUpdates extensions
- All extensions
- Extensions included in Miraheze