Module:LootChest/doc
This is the documentation page for Module:LootChest
.base usage (Template:LootChest)
Generates a table of the contents of the designated chests, with columns corresponding to various statistics about the availability of those items.
Invoking
It takes any number of chest parameters, and any number of column parameters, in no particular order.
If no chest parameters are listed, it displays them all; likewise for column parameters.
{{#invoke:LootChest|base [ |<chestParam1> ... |<chestParamN> ] [ |<columnHideParam1> ... |<columnHideParamN> ] }}
.base2 usage (Template:LootChestItem inline)
Prints a summary of this item's availability in the various worldgen chests.
Invoking
It takes exactly one item name as a parameter.
{{#invoke:LootChest|base2|<itemParam>}}
.base3 usage (Template:LootChestItem table)
Prints a summary of this item's availability in the various worldgen chests in the form of a table.
Invoking
It takes exactly one item name as a parameter.
{{#invoke:LootChest|base3|<itemParam>}}
Source
- The data is set up within
p
so that it can be pulled directly from (or compared directly to) the minecraft loot table files. - stack size given here (and given in code) can be larger than the stackable size of the item, prominently in the case of enchanted books. However this fact does not affect the calculated values. This is because the game puts the right number of items, but unstacked rather than stacked.
Data structure
p.items
'<item-id>' = {
- This key must match a sprite name for the items/blocks defined in Template:Sprites/BlockSprite or Template:Sprites/ItemSprite, unless
id
is included in the item definition.
- This key must match a sprite name for the items/blocks defined in Template:Sprites/BlockSprite or Template:Sprites/ItemSprite, unless
'<sprite-type>'
- Either
item
orblock
.
- Either
[, id='<sprite-id>']
- Use this to specify a sprite defined in Template:Sprites/BlockSprite or Template:Sprites/ItemSprite. Otherwise it uses the sprite with the name given by
item-id
.
- Use this to specify a sprite defined in Template:Sprites/BlockSprite or Template:Sprites/ItemSprite. Otherwise it uses the sprite with the name given by
[, link='<item-link>']
- A link to a page that is different from the sprite-id name. Used in Template:LootChest.
[, title='<item-text>']
- A name for an item that is different from the sprite-id name.
[, cannot_stack=false]
- Use this to indicate that the item comes in groups rather than in stacks. Used in Template:LootChestItem.
[, plural=(false|'<custom-plural-word>')]
- Use
false
when a word has no plural, like 'Nether Wart'. Use a custom plural word when you cannot simply append an 's' to the base word to make it plural, like 'Bottles o' Enchanting'. Used in Template:LootChestItem.
- Use
[, preserve_case=false]
- Use
false
when an item name should follow the capitalization exactly specified intitle
, and not follow sentence case, like 'TNT'.
- Use
[, note='<note-name>']
- Indicates that a note appears next to this item in the table. (notes are defined directly below the item list)
}
p.notes
'<note-name>' = '<note-full-text>'
p.chests[n].poolsJava[n]
p.chests[n].poolsJavaUpcoming[n]
p.chests[n].poolsBedrock[n]
p.chests[n].poolsBedrockUpcoming[n]
- rolls
{ <min-number-of-stacks>, <max-number-of-stacks> }
p.chests[n].poolsJava[n].items
p.chests[n].poolsJavaUpcoming[n].items
p.chests[n].poolsBedrock[n].items
p.chests[n].poolsBedrockUpcoming[n].items
'<item-id>' = { <min-stack-size>, <max-stack-size>, <item-weight> }
p.synonyms
'<chest-name-synonym>' = '<original-interally-valid-chest-name>'
- Allows additional chest names to be used as parameters, in addition to the ones defined in p.chests.
p.display_names
'<chest-name-given-via-parameter>' = '<name-displayed-in-single-chest-table>'
- If a single chest parameter is used, this defines the name it is called in the summary text above the table.
p.columns
'<column-name>' = '<column-full-description>'
- The column descriptions, found either in the tooltip on the column header, or in the summary text above the table.
Functions
The following functions are made available at the top of the file, for ease of inspection.
calc_average_amount_this_item_per_chest
- average number of a certain item (not number of stacks), per-chest (not per-structure).
calc_chance_any_of_this_item_per_chest
- chance that at least one of a certain item is present, per-chest (not per-structure).
Item tests
{{#invoke:LootChest|base2_test}}
Notes