Module:LootChest2

Jump to navigation Jump to search

Usage[edit source]

TBA

Audit[edit source]

d.items that aren't in any d.chests:

  • copper-horn

d.notes that aren't on any d.items:

  • none

d.chests containing items that aren't in d.items:

  • none

d.items containing notes that aren't in d.notes:

  • none

editions:

  • bedrock
  • java
[view] [edit] [history] [refresh]The above documentation is transcluded from Module:LootChest2/doc.
-- 
-- d: data
-- 
-- f: helper functions
-- 
-- p: the package, exposing: 
--     audit
--     make_item_table
--     make_chest_table
-- 

d = {

	-- The key-value pairs in d.items define how the item's sprite and label are put together.
	-- 
	-- [<item-name>] = { <sprite-sheet> [, <id>] [, <link>] [, <title>] [, <note>] [, <note1>] }
	-- 
	--    <item-name>:       This is the name used when invoking this module via p.make_item_table().
	--                       It is also the name used later, in the loot tables in d.chests.
	-- 
	--    <sprite-sheet>:    Whether the sprite comes from BlockSprite or ItemSprite.
	--       "block"
	--       | "item"
	-- 
	--    <id>:              optional: the sprite id from the sprite sheet.
	--                         If left unspecified, defaults to <item-name>.
	-- 
	--    <link>:            optional: the wiki page to link to. 
	--                         If left unspecified, defaults to <item-name>, but with dashes turned to spaces, and transformed to title case.
	-- 
	--    <title>:           optional: the text to display.
	--                         If left unspecified, defaults to <item-name>, but with dashes turned to spaces, and:
    --                             * transformed to sentence case and possibly made plural, according to the value of <plural>, in p.make_item_table(), or
	--                             * transformed to title case, in p.make_chest_table().
	-- 
	--    <plural>:          optional: either false, or a string having a custom plural form.
	--                         This affects the header text of p.make_item_table(), which starts with <title>.
	--                         When false, the <title> is left as-is.
	--                         When a string is given, <plural> is used in place of <title>.
	--                         If left unspecified, <title> is run through f.plural().
	-- 
	--    <note>, <note2>:   optional: up to two notes can be specified, by key.
	--                         The value of the notes (its text) is defined just below here, in d.notes.
	-- 
	-- The order within this list doesn't matter.
	
	items = {
		["acacia-log"]          = { "block", link="Log" },
		["acacia-sapling"]      = { "block", link="Sapling" },
		["activator-rail"]      = { "block" },
		["ancient-debris"]      = { "block", plural=false },
		["apple"]               = { "item" },
		["arrow"]               = { "item" },
		["bamboo"]              = { "item", plural=false },
		["barrel"]              = { "block" },
		-- ["basalt"]				= { "block", plural=false },
		["beetroot-seeds"]      = { "item", plural=false },
		["beetroot-soup"]		= { "item", plural=false },
		["bell"]				= { "block" },
		["birch-log"]           = { "block", link="Log" },
		["birch-sapling"]       = { "block", link="Sapling" },
		["black-wool"]          = { "block", link="Wool", plural=false },
		["block-of-gold"]       = { "block", plural="Blocks of gold" },
		["blue-ice"]			= { "block", plural=false },
		["bone"]                = { "item" },
		["bone-block"]          = { "block" },
		["book"]                = { "item" },
		["book-and-quill"]      = { "item", title="Book and Quill", plural=false },
		["bottle-o'-enchanting"] = { "item", title="Bottle o' Enchanting", plural="Bottles o' enchanting" },
		["bread"]               = { "item", plural=false },
		["brown-mushroom"]      = { "block", link="Mushroom" },
		["brown-wool"]          = { "block", link="Wool", plural=false },
		["bucket"]              = { "item" },
        ["buried-treasure-map"] = { "item", link="Explorer Map" },
		["cactus"]              = { "block", plural=false },
		["cake"]                = { "block", plural=false },
		["carrot"]              = { "item" },
		["chain"]               = { "block" },
		["chainmail-boots"]     = { "item", link="Armor", plural=false },
		["chainmail-chestplate"] = { "item", link="Armor" },
		["chainmail-helmet"]    = { "item", link="Armor" },
		["chainmail-leggings"]  = { "item", link="Armor", plural=false },
		["clay"]				= { "item", link="Clay (ball)", plural=false },
		["clock"]				= { "item" },
		["coal"]                = { "item", plural=false },
		["cocoa-beans"]         = { "item", plural=false },
		["cooked-cod"]          = { "item", plural=false },
		["cooked-porkchop"]		= { "item" },
		["cooked-salmon"]       = { "item", plural=false },
		["copper-horn"]         = { "item" },
		["compass"]             = { "item" },
		["crimson-fungus"]		= { "block", link="Fungus", plural="Crimson fungi" },
		["crimson-nylium"]		= { "block", link="Nylium", plural=false },
		["crimson-roots"]		= { "block", link="Roots" , plural=false },
		["crossbow"]            = { "item" },
		["crying-obsidian"]		= { "block" },
		["dandelion"]			= { "block", link="Flower" },
		["dark-oak-log"]        = { "block", link="Log" },
		["dark-oak-sapling"]    = { "block", link="Sapling" },
		["dead-bush"]			= { "block", link="Dead Bush" },
		["detector-rail"]       = { "block" },
		["diamond"]             = { "item" },
		["diamond-chestplate"]  = { "item", link="Armor" },
		["diamond-hoe"]         = { "item", link="Hoe" },
		["diamond-horse-armor"] = { "item", link="Horse Armor", plural=false },
		["disc-13"]             = { "item", id='music-disc-13', title="Music Disc (13)", link="Music Disc", plural="Music discs (13)" },
		["disc-cat"]            = { "item", id='music-disc-cat', title="Music Disc (cat)", link="Music Disc", plural="Music discs (cat)" },
		["disc-mellohi"]        = { "item", id='music-disc-mellohi', title="Music Disc (mellohi)", link="Music Disc", plural="Music discs (mellohi)" },
		["disc-pigstep"]		= { "item", id='music-disc-pigstep', title = "Music Disc (Pigstep)", link="Music Disc", plural="Music discs (Pigstep)" },
		["disc-wait"]           = { "item", id='music-disc-wait', title="Music Disc (wait)", link="Music Disc", plural="Music discs (wait)" },
		["egg"]           		= { "item" },
		["emerald"]             = { "item" },
		["empty-map"]           = { "item", link="Map", title="Empty Map" },
		["enchanted-book"]      = { "item", id='enchanted-book', title="Enchanted Book", link="Enchanted Book", note="enchant-with-levels-30" },
		["enchanted-book-rnd"]  = { "item", id='enchanted-book', title="Enchanted Book", link="Enchanted Book", note="enchant-randomly" },
		["enchanted-book-rnd-soul-speed"] = { "item", id='enchanted-book', title="Enchanted Book", link="Enchanted Book", note="enchant-randomly-soul-speed" },
		["enchanted-fishing-rod"] = { "item", id="fishing-rod", link="Fishing Rod", note="enchant-randomly" },
		["enchanted-golden-apple"] = { "item" },
		["ender-pearl"]         = { "item" },
		["feather"]             = { "item" },
		["fern"]				= { "block", link="Grass" },
		["fire-charge"]			= { "item" },
		["flint"]               = { "item", plural=false },
		["flint-and-steel"]     = { "item", plural=false },
		["flower-pot"]			= { "item" },
		["furnace"]             = { "block" },
		["gilded-blackstone"]	= { "block", plural=false },
		["glistering-melon-slice"] = { "item" },
		["glowstone"]			= { "block", plural=false },
		["golden-apple"]        = { "item" },
		["golden-boots"]		= { "item", link="Armor", plural=false },
		["golden-carrot"]		= { "item" },
		["golden-chestplate"]   = { "item", link="Armor" },
		["golden-helmet"]       = { "item", link="Armor" },
		-- ["golden-hoe"]			= { "item", link="Hoe" },
		["golden-horse-armor"]  = { "item", link="Horse Armor", plural=false },
		["golden-leggings"]		= { "item", link="Armor", plural=false },
		["golden-sword"]        = { "item", link="Sword" },
		["gold-ingot"]          = { "item" },
		["gold-nugget"]         = { "item" },
		["grass"]				= { "block", link="Grass", plural=false },
		["gray-wool"]           = { "block", link="Wool", plural=false },
		["green-dye"]			= { "item", link="Dye", plural=false },
		["gunpowder"]           = { "item", plural=false },
		["heart-of-the-sea"]    = { "item", link="Heart of the Sea", plural=false },
		["ink-sac"]             = { "item" },
		["iron-boots"]          = { "item", link="Armor", plural=false },
		["iron-chestplate"]     = { "item", link="Armor" },
		["iron-helmet"]         = { "item", link="Armor" },
		["iron-horse-armor"]    = { "item", link="Horse Armor", plural=false },
		["iron-ingot"]          = { "item" },
		["iron-leggings"]       = { "item", link="Armor", plural=false },
		["iron-nugget"]         = { "item" },
		["iron-pickaxe"]        = { "item", link="Pickaxe" },
		["iron-shovel"]         = { "item", link="Shovel" },
		["iron-sword"]          = { "item", link="Sword" },
		["jungle-log"]          = { "block", link="Log" },
		["jungle-sapling"]      = { "block", link="Sapling" },
		["lapis-lazuli"]        = { "item", plural=false },
		["large-fern"]			= { "block", link="Grass" },
		["lead"]                = { "item" },
		["leather"]      		= { "item", plural=false },
		["leather-boots"]       = { "item", link="Armor", plural=false },
		["leather-cap"]         = { "item", link="Armor" },
		["leather-pants"]       = { "item", link="Armor", plural=false },
		["leather-tunic"]       = { "item", link="Armor" },
		["light-gray-wool"]     = { "block", link="Wool", plural=false },
		["light-weighted-pressure-plate"] = { "block", link="Pressure Plate" },
		["lodestone"]			= { "block" },
		["melon-seeds"]         = { "item", plural=false },
		-- ["magma-block"]			= { "block" },
		["magma-cream"]         = { "item", plural=false },
		["name-tag"]            = { "item" },
		["netherite-ingot"]     = { "item" },
		["netherite-scrap"]     = { "item", plural=false },
		["nether-wart"]         = { "item", plural=false },
		["nether-quartz"]		= { "item", plural=false },
		["oak-log"]             = { "block", link="Log" },
		["oak-planks"]          = { "block", link="Planks", id="oak-wood-planks", plural=false },
		["oak-sapling"]         = { "block", link="Sapling" },
		["oak-sign"]            = { "item", link="Sign" },
		["obsidian"]            = { "block", plural=false },
		["paper"]               = { "item", plural=false },
		["poisonous-potato"]    = { "item", plural="Poisonous potatoes" },
		-- ["polished-basalt"]		= { "block", plural=false },
		["poppy"]				= { "block", link="Flower" },
		["potato"]              = { "item", plural="Potatoes" },
		["potion-of-regeneration"] = { "item", link="Potion", title="Potion of Regeneration", plural="Potions of Regeneration" },
		["potion-of-water-breathing"] = { "item", link="Potion", title="Potion of Water Breathing", plural="Potions of Water Breathing" },
		["powered-rail"]        = { "block", title="Powered Rails", plural=false },
		["prismarine-crystals"] = { "item", plural=false },
		["pumpkin"]             = { "block" },
		["pumpkin-pie"]         = { "item" },
		["pumpkin-seeds"]       = { "item", plural=false },
		["rail"]                = { "block", title="Rails", plural=false },
		["raw-beef"]		    = { "item", plural=false },
		["raw-cod"]             = { "item", plural=false },
		["raw-mutton"]			= { "item", plural=false },
		["raw-porkchop"]		= { "item" },
		["raw-salmon"]          = { "item", plural=false },
		["redstone"]            = { "item", id="redstone-dust", title="Redstone Dust", plural=false },
		["rotten-flesh"]        = { "item", plural=false },
		["saddle"]              = { "item" },
		["sand"]                = { "block", plural=false },
		["shears"]              = { "item", plural=false },
		["smooth-stone"]		= { "block", plural=false },
		["snout-banner-pattern"] = { "item", id="banner-pattern", link="Banner Pattern" },
		["snowball"]			= { "item", link="Snowball" },
		["snow-block"]			= { "block", link="Snow Block" },
		["soul-sand"]			= { "block", plural=false },
		["spectral-arrow"]      = { "item" },
		["spider-eye"]          = { "item" },
		["spruce-log"]          = { "block", link="Log" },
		["spruce-sapling"]      = { "block", link="Sapling" },
		["spruce-sign"]     	= { "item", link="Sign" },
		["stick"]               = { "item" },
		["stone"]               = { "block", plural=false },
		["stone-axe"]           = { "item", link="Axe" },
		["stone-bricks"]        = { "block", plural=false },
		["stone-pickaxe"]       = { "item", link="Pickaxe" },
		["string"]              = { "item", plural=false },
		["suspicious-stew"]     = { "item", plural=false, note="suspicious-stew" },
		["sweet-berries"]       = { "item", plural=false },
		["tall-grass"]			= { "block", link="Grass", plural=false },
		["tnt"]                 = { "block", title="TNT", plural=false },
		["torch"]               = { "block" },
		["tripwire-hook"]       = { "block" },
		["water-bucket"]        = { "item" },
		["wheat"]               = { "item" },
		["wheat-seeds"]         = { "item", plural=false },
		["white-wool"]          = { "block", link="Wool", plural=false },
		["wooden-axe"]          = { "item", link="Axe" },
		["wooden-pickaxe"]      = { "item", link="Pickaxe" },
		["yellow-dye"]			= { "item", link="Dye", plural=false },
		["map"]                 = { "item", link="Map", note="map" },

		-- ["damaged-random-enchanted-netherite-axe"] = { "item", id="netherite-axe", title="Damaged Enchanted Netherite Axe", link="Axe", note="enchant-randomly", note1="damaged-0.15-0.85" },
		["damaged-netherite-boots"]				= { "item", id="netherite-boots", link="Armor", note="damaged-0.2-0.65", plural=false},
		-- ["damaged-level-enchanted-netherite-boots"] = { "item", id="netherite-boots", title="Damaged Enchanted Netherite Boots", link="Armor", note="enchant-with-levels-5-20", note1="damaged-0.2-0.65", plural=false },
		["damaged-netherite-chestplate"]		= { "item", id="netherite-chestplate", link="Armor", note="damaged-0.2-0.65"},
		-- ["damaged-level-enchanted-netherite-chestplate"] = { "item", id="netherite-chestplate", title="Damaged Enchanted Netherite Chestplate", link="Armor", note="enchant-with-levels-5-20", note1="damaged-0.2-0.65" },
		["damaged-netherite-helmet"]			= { "item", id="netherite-helmet", link="Armor", note="damaged-0.2-0.65"},
		-- ["damaged-random-enchanted-netherite-hoe"] = { "item", id="netherite-hoe", title="Damaged Enchanted Netherite Hoe", link="Hoe", note="enchant-randomly", note1="damaged-0.1-0.95" },
		-- ["damaged-level-enchanted-netherite-helmet"] = { "item", id="netherite-helmet", title="Damaged Enchanted Netherite Helmet", link="Armor", note="enchant-with-levels-5-20", note1="damaged-0.2-0.65" },
		["damaged-netherite-leggings"]			= { "item", id="netherite-leggings", link="Armor", note="damaged-0.2-0.65", plural=false},
		-- ["damaged-level-enchanted-netherite-leggings"] = { "item", id="netherite-leggings", title="Damaged Enchanted Netherite Leggings", link="Armor", note="enchant-with-levels-5-20", note1="damaged-0.2-0.65", plural=false },
		-- ["damaged-random-enchanted-netherite-pickaxe"] = { "item", id="netherite-pickaxe", title="Damaged Enchanted Netherite Pickaxe", link="Pickaxe", note="enchant-randomly", note1="damaged-0.1-0.95" },
		["damaged-random-enchanted-netherite-shovel"] = { "item", id="netherite-shovel", title="Damaged Enchanted Netherite Shovel", link="Shovel", note="enchant-randomly", note1="damaged-0.15-0.45"},
		["damaged-netherite-sword"]				= { "item", id="netherite-sword", link="Sword", note="damaged-0.2-0.65"},
		-- ["damaged-level-enchanted-netherite-sword"] = { "item", id="netherite-sword", title="Damaged Enchanted Netherite Sword", link="Sword", note="enchant-with-levels-5-20", note1="damaged-0.2-0.65" },
		["damaged-diamond-boots"]				= { "item", id="diamond-boots", link="Armor", note="damaged-0.2-0.65", plural=false },
		["level-enchanted-diamond-boots"]		= { "item", id="diamond-boots", title="Enchanted Diamond Boots", link="Armor", note="enchant-with-levels-20-39", plural=false },
		["damaged-random-enchanted-diamond-boots"] = { "item", id="diamond-boots", title="Damaged Enchanted Diamond Boots", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65", plural=false },
		["damaged-diamond-chestplate"]			= { "item", id="diamond-chestplate", link="Armor", note="damaged-0.2-0.65" },
		["level-enchanted-diamond-chestplate"]	= { "item", id="diamond-chestplate", title="Enchanted Diamond Chestplate", link="Armor", note="enchant-with-levels-20-39" },
		["damaged-random-enchanted-diamond-chestplate"] = { "item", id="diamond-chestplate", title="Damaged Enchanted Diamond Chestplate", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65" },
		["damaged-diamond-helmet"]				= { "item", id="diamond-helmet", link="Armor", note="damaged-0.2-0.65" },
		["level-enchanted-diamond-helmet"]		= { "item", id="diamond-helmet", title="Enchanted Diamond Helmet", link="Armor", note="enchant-with-levels-20-39" },
		["damaged-random-enchanted-diamond-helmet"] = { "item", id="diamond-helmet", title="Damaged Enchanted Diamond Helmet", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65" },
		["damaged-diamond-leggings"]			= { "item", id="diamond-leggings", link="Armor", note="damaged-0.2-0.65", plural=false },
		["level-enchanted-diamond-leggings"]	= { "item", id="diamond-leggings", title="Enchanted Diamond Leggings", link="Armor", note="enchant-with-levels-20-39", plural=false },
		["damaged-random-enchanted-diamond-leggings"] = { "item", id="diamond-leggings", title="Damaged Enchanted Diamond Leggings", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65", plural=false },
		["level-enchanted-diamond-pickaxe"]		= { "item", id="diamond-pickaxe", title="Enchanted Diamond Pickaxe", link="Pickaxe", note="enchant-with-levels-20-39" },
		["level-enchanted-diamond-shovel"]		= { "item", id="diamond-shovel", title="Enchanted Diamond Shovel", link="Shovel", note="enchant-with-levels-20-39" },
		["damaged-random-enchanted-diamond-shovel"] = { "item", id="diamond-shovel", title="Damaged Enchanted Diamond Shovel", link="Shovel", note="enchant-randomly", note1="damaged-0.15-0.45" },
		["damaged-diamond-sword"]				= { "item", id="diamond-sword", link="Sword", note="damaged-0.2-0.65" },
		["level-enchanted-diamond-sword"]		= { "item", id="diamond-sword", title="Enchanted Diamond Sword", link="Sword", note="enchant-with-levels-20-39" },
		["damaged-random-enchanted-diamond-sword"] = { "item", id="diamond-sword", title="Damaged Enchanted Diamond Sword", link="Sword", note="enchant-randomly", note1="damaged-0.2-0.65" },
		["level-enchanted-iron-boots"]			= { "item", id="iron-boots", title="Enchanted Iron Boots", link="Armor", note="enchant-with-levels-20-39", plural=false },
		["level-enchanted-iron-chestplate"]		= { "item", id="iron-chestplate", title="Enchanted Iron Chestplate", link="Armor", note="enchant-with-levels-20-39" },
		["level-enchanted-iron-helmet"]			= { "item", id="iron-helmet", title="Enchanted Iron Helmet", link="Armor", note="enchant-with-levels-20-39" },
		["level-enchanted-iron-leggings"]		= { "item", id="iron-leggings", title="Enchanted Iron Leggings", link="Armor", note="enchant-with-levels-20-39", plural=false },
		["level-enchanted-iron-pickaxe"]		= { "item", id="iron-pickaxe", title="Enchanted Iron Pickaxe", link="Pickaxe", note="enchant-with-levels-20-39" },
		["level-enchanted-iron-shovel"]			= { "item", id="iron-shovel", title="Enchanted Iron Shovel", link="Shovel", note="enchant-with-levels-20-39" },
		["level-enchanted-iron-sword"]			= { "item", id="iron-sword", title="Enchanted Iron Sword", link="Sword", note="enchant-with-levels-20-39" },
		["random-enchanted-golden-axe"]			= { "item", id="golden-axe", title="Enchanted Golden Axe", link="Axe", note="enchant-randomly" },
		-- ["level-enchanted-golden-boots"]      	= { "item", id="golden-boots", title="Enchanted Golden Boots", link="Armor", note="enchant-with-levels-5-15", plural=false },
		["random-enchanted-golden-boots"]		= { "item", id="golden-boots", title="Enchanted Golden Boots", link="Armor", note="enchant-randomly", plural=false },
		["soul-speed-enchanted-golden-boots"]   = { "item", id="golden-boots", title="Enchanted Golden Boots with Soul Speed", link="Armor", note="enchant-randomly-soul-speed", plural=false },
		-- ["level-enchanted-golden-chestplate"]	= { "item", id="golden-chestplate", title="Enchanted Golden Chestplate", link="Armor", note="enchant-with-levels-5-15" },
		["random-enchanted-golden-chestplate"]	= { "item", id="golden-chestplate", title="Enchanted Golden Chestplate", link="Armor", note="enchant-randomly" },
		["random-enchanted-golden-helmet"]		= { "item", id="golden-helmet", title="Enchanted Golden Helmet", link="Armor", note="enchant-randomly" },
		["random-enchanted-golden-hoe"]			= { "item", id="golden-hoe", title="Enchanted Golden Hoe", link="Hoe", note="enchant-randomly" },
		["random-enchanted-golden-leggings"]	= { "item", id="golden-leggings", title="Enchanted Golden Leggings", link="Armor", note="enchant-randomly", plural=false },
		["random-enchanted-golden-pickaxe"]		= { "item", id="golden-pickaxe", title="Enchanted Golden Pickaxe", link="Pickaxe", note="enchant-randomly" },
		["random-enchanted-golden-shovel"]		= { "item", id="golden-shovel", title="Enchanted Golden Shovel", link="Shovel", note="enchant-randomly" },
		["random-enchanted-golden-sword"]		= { "item", id="golden-sword", title="Enchanted Golden Sword", link="Sword", note="enchant-randomly" },
		["random-enchanted-leather-boots"]		= { "item", id="leather-boots", title="Enchanted Leather Boots", link="Armor", note="enchant-randomly", plural=false },
		["random-enchanted-leather-cap"]		= { "item", id="leather-cap", title="Enchanted Leather Cap", link="Armor", note="enchant-randomly" },
		["random-enchanted-leather-pants"]		= { "item", id="leather-pants", title="Enchanted Leather Pants", link="Armor", note="enchant-randomly", plural=false },
		["random-enchanted-leather-tunic"]		= { "item", id="leather-tunic", title="Enchanted Leather Tunic", link="Armor", note="enchant-randomly" },
		-- ["damaged-level-enchanted-crossbow"]	= { "item", id="crossbow", title="Damaged Enchanted Crossbow", link="Crossbow", note="enchant-with-levels-20-25", note1="damaged-0.05-0.15" },
		["damaged-random-enchanted-crossbow"]	= { "item", id="crossbow", title="Damaged Enchanted Crossbow", link="Crossbow", note="enchant-randomly", note1="damaged-0.1-0.5" },
		
		["damaged-random-enchanted-netherite-helmet"] = { "item", id="netherite-helmet", title="Damaged Enchanted Netherite Helmet", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65" },
		["damaged-random-enchanted-netherite-chestplate"] = { "item", id="netherite-chestplate", title="Damaged Enchanted Netherite Chestplate", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65" },
		["damaged-random-enchanted-netherite-leggings"]	= { "item", id="netherite-leggings", title="Damaged Enchanted Netherite Leggings", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65", plural=false },
		["damaged-random-enchanted-netherite-boots"] = { "item", id="netherite-boots", title="Damaged Enchanted Netherite Boots", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65", plural=false },
		["damaged-random-enchanted-netherite-sword"] = { "item", id="netherite-sword", title="Damaged Enchanted Netherite Sword", link="Sword", note="enchant-randomly", note1="damaged-0.2-0.65" },
		
		["empty"] = { "block", id="air", link='', title='Nothing', plural=false, note="nothing" },
	},


	
	-- The key-value pairs in d.notes define the text that goes into an item's note, to be displayed in a notelist.
	-- 
	-- It gets rendered on the page like so:
	-- <ref group='note' name='enchant-randomly'>
	-- 
	-- The order within this list doesn't matter.
	
	notes = {
		-- ["damaged-0.05-0.15"]			= "The item will only have between 5% and 15% of its total durability.",
		["damaged-0.1-0.5"]				= "The item will only have between 10% and 50% of its total durability.",
		-- ["damaged-0.1-0.95"]			= "The item will only have between 10% and 95% of its total durability.",
		["damaged-0.15-0.45"]			= "The item will only have between 15% and 45% of its total durability.",
		-- ["damaged-0.15-0.85"]			= "The item will only have between 15% and 85% of its total durability.",
		["damaged-0.2-0.65"]			= "The item will only have between 20% and 65% of its total durability.",
		["enchant-randomly"]			= "All enchantments are equally probable, ''including'' [[treasure enchantment]]s (except [[Soul Speed]]), and any level of the enchantment is equally probable.",
		["enchant-randomly-soul-speed"]	= "Enchanted with a random level of [[Soul Speed]].",
		-- ["enchant-with-levels-5-15"]	= "Enchantment probabilities are the same as a level-5 to level-15 [[enchantment mechanics|enchantment]] would be on an [[enchantment table]] that was able to apply [[treasure enchantment]]s (except [[Soul Speed]]), and where the chance of multiple enchantments is not reduced.",
		-- ["enchant-with-levels-5-20"]	= "Enchantment probabilities are the same as a level-5 to level-20 [[enchantment mechanics|enchantment]] would be on an [[enchantment table]] that was able to apply [[treasure enchantment]]s (except [[Soul Speed]]), and where the chance of multiple enchantments is not reduced.",
		["enchant-with-levels-20-39"]	= "Enchantment probabilities are the same as a level-20 to level-39 [[enchantment mechanics|enchantment]] would be on an [[enchantment table]] that had no cap at level 30, and that was able to apply [[treasure enchantment]]s (except [[Soul Speed]]), and where the chance of multiple enchantments is not reduced.",
		-- ["enchant-with-levels-20-25"]	= "Enchantment probabilities are the same as a level-20 to level-25 [[enchantment mechanics|enchantment]] would be on an [[enchantment table]] that was able to apply [[treasure enchantment]]s (except [[Soul Speed]]), and where the chance of multiple enchantments is not reduced.",
		["enchant-with-levels-30"]		= "Enchantment probabilities are the same as a level-30 enchantment on an [[enchantment table]] that was able to apply [[treasure enchantment]]s (except [[Soul Speed]]), and where the chance of multiple enchantments is not reduced.",
		["map"]							= "Named unknown map, but changed to map 0, the scale level is 1:4, Maps from the same stack are stackable, but maps that are not stacked are unstackable despite looking identical.",
		["nothing"]						= "'Nothing' does not refer to the chance of an empty chest.  Instead, it refers to the chance that the random loot generator does not add any loot ''on a single roll''.",
		["suspicious-stew"]				= "The stew grants one of the following effects: 5–7 seconds of [[Blindness]], 7–10 seconds of [[Jump Boost]], 7-10 seconds of [[Night Vision]], 10–20 seconds of [[Poison]], 7–10 seconds of [[Saturation]], or 6–8 seconds of [[Weakness]]."
	},



	-- The key-value pairs in d.column_hovertext define the hovertext that goes onto a column header, using the <abbr> tag.
	
	column_hovertext = {
		["stacksize"] = 'The size of stacks (or for unstackable items, number) of this item on any given roll.',
		["rolls"] = 'The number of times this chest draws item stacks randomly from this item\'s pool.',
		["weight"] = 'The weight of this item relative to other items in the pool.',
		["items"] = 'The number of items expected per chest, averaged over a large number of chests.',
		["chance"] = 'The odds of finding any of this item in a single chest.',
		["chests"] = 'The average number of chests the player should expect to search, to find any of this item.'
	},
	
	
	
	-- The key-value pairs in d.edition_headers maps the <edition> name used in d.chests to the column text for that edition.
	-- If d.chests uses an edition not in this list, that's okay. The extra header will still display.
	
	
	edition_headers = {
		["java"] = "Java",
		["bedrock"] = "Bedrock",
	},
	
	
	
	-- The key-value pairs in d.chests define the loot tables.
	-- 
	-- [<chest-name>] = { 
	--    chest_table_display = { header = <header> [, superheader = <superheader>] },
	--    item_table_display  = { structure_id = <structure-id>, structure_text = <structure-text> [, container = <container>] },
	--    loot_tables = { <loot-table> [, <loot-table>] ... }
	-- }
	-- 
	--    <chest-name>:      This is the name used when invoking this module via p.make_chest_table().
	-- 
	--    <header>:          When invoking this module via p.make_chest_table() with multiple chests, this is a column header with the name of the chest.
	--                         This header spans all columns generated for this chest.
	--    <superheader>:     optional: When invoking this module via p.make_chest_table() with multiple chests, this is a column header with the name of the structure.
	--                         This header spans all columns generated for ALL chests having the same superheader, and sits above the chest header.
	--                         Typically you use this when one structure has multiple kinds of chests.
	--                         If left unspecified, the chest will not group with other chests under any superheader.
	-- 
	--    <structure-id>:    When invoking this module via p.make_item_table(), this id determines the sprite from {{EnvSprite}}.
	--    <structure-text>:  When invoking this module via p.make_item_table(), this is the text next to the structure sprite.
	--    <container>:       optional: When invoking this module via p.make_item_table(), 
	--                         Typically you use this when one structure has multiple kinds of chests.
	--                         If left unspecified, the chest entry will just show the structure link, and will not show any subtitle specifying a chest.
	-- 
	--    <loot-table>: {    <loot-table> has the meaning: for the editions listed, use these loot_tables.
	--       <edition-list>,   The first element is an <edition-list>,
	--       <pool> ...        The rest are <pool> elements.
	--    }
	-- 
	--    <edition-list>:    A list of 1 or more <edition> elements.
	--    {
	--       <edition>
	--       [, <edition>]
	--       ...
	--    }
	-- 
	--    <edition>:         These are the current editions, and their -upcoming suffixes.
	--       "java"
	--       | "bedrock"
	--       | "java-upcoming"
	--       | "bedrock-upcoming"
	--                       If there were suddenly to be another edition, for instance "playstation",
	--                       simply use "playstation" and "playstation-upcoming" also, and the proper columns would appear in the table.
	-- 
	--    <pool>: 
	--    {
	--       rolls = { <min-rolls>, <max-rolls> },  Each pool contains a min and a max number of "rolls",
	--       items = {                              and a list of 1 or more <item-entry> elements.
	--          <item-entry>
	--          [, <item-entry>]
	--          ...
	--       }
	--    }
	-- 
	--    <min-rolls>:       For each pool in a loot table, the game "rolls" (picks a random entry from the list of items) some number of times: between <min-rolls> and <max-rolls>.
	--    <max-rolls>:       See above.
	-- 
	--    <item-entry>:
	--       [<item-name>] = { <min-stack-size>, <max-stack-size>, <weight> }
	-- 
	--    <item-name>:       This name refers to (and must match) an entry in d.items.
	-- 
	--    <min-stack-size>:  When the game picks this item, it chooses a stack size between <min-stack-size> and <max-stack-size>.
	--    <max-stack-size>:  See above.
	-- 
	--    <weight>:          When the game does a "roll" in pool, each item may have its own "weight", so that higher weights are more likely to be picked.
	-- 
	-- The order within this list doesn't matter.
	--   in the item table, sorting is alphabetical by <structure_text>, then by <container>.
	--   in the chest table, items will sort by chance, then by avg#, then alphabetically.
	
	chests = {
	
		["shipwreck-map"] = { -- shipwreck_map.json
			chest_table_display = { header="Map", superheader="[[Shipwreck]]" },
			item_table_display  = { structure_id="shipwreck", structure_text="Shipwreck", container="Map chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,1},
						items = {
	                        ["buried-treasure-map"] = {1,1,1},
						}
					},
					{
						rolls = {3,3},
						items = {
							["compass"]             = {1,1,1},
							["empty-map"]           = {1,1,1},
							["clock"]               = {1,1,1},
							["paper"]               = {1,10,20},
							["feather"]             = {1,5,10},
							["book"]                = {1,5,5},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,1},
						items = {
							["buried-treasure-map"] = {1,1,1},
						}
					},
					{
						rolls = {3,3},
						items = {
							["compass"]             = {1,1,1},
							["map"]                 = {1,1,1},
							["clock"]               = {1,1,1},
							["paper"]               = {1,10,20},
							["feather"]             = {1,5,10},
							["book"]                = {1,5,5},
						}
					},
				},
			}
		},
		
		["shipwreck-supply"] = { -- shipwreck_supply.json
			chest_table_display = { header="Supply", superheader="[[Shipwreck]]" },
			item_table_display  = { structure_id="shipwreck", structure_text="Shipwreck", container="Supply chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,10},
						items = {
							["paper"]               = {1,12,8},
							["potato"]              = {2,6,7},
							["poisonous-potato"]    = {2,6,7},
							["carrot"]              = {4,8,7},
							["wheat"]               = {8,21,7},
							["coal"]                = {2,8,6},
							["rotten-flesh"]        = {5,24,5},
							["bamboo"]              = {1,3,2},
							["suspicious-stew"]     = {1,1,10},
							["pumpkin"]             = {1,3,2},
							["gunpowder"]           = {1,5,3},
							["tnt"]                 = {1,2,1},
							["random-enchanted-leather-cap"]         = {1,1,3},
							["random-enchanted-leather-tunic"]       = {1,1,3},
							["random-enchanted-leather-pants"]       = {1,1,3},
							["random-enchanted-leather-boots"]       = {1,1,3},
						}
					},
				},
			}
		},
		
		["shipwreck-treasure"] = { -- shipwreck_treasure.json
			chest_table_display = { header="Treasure", superheader="[[Shipwreck]]" },
			item_table_display  = { structure_id="shipwreck", structure_text="Shipwreck", container="Treasure chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,6},
						items = {
							["iron-ingot"]          = {1,5,90},
							["gold-ingot"]          = {1,5,10},
							["emerald"]             = {1,5,40},
							["diamond"]             = {1,1,5},
							["bottle-o'-enchanting"] = {1,1,5},
						}
					},
					{
						rolls = {2,5},
						items = {
							["iron-nugget"]         = {1,10,50},
							["gold-nugget"]         = {1,10,10},
							["lapis-lazuli"]        = {1,10,20},
						}
					},
				},
			}
		},
		
		["buried-treasure"] = { -- buried_treasure.json
			chest_table_display = { header="[[Buried treasure]]" },
			item_table_display  = { structure_id="buried-treasure", structure_text="Buried treasure" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,1},
						items = {
							["heart-of-the-sea"]    = {1,1,1},
						}
					},
					{
						rolls = {5,8},
						items = {
							["iron-ingot"]          = {1,4,20},
							["gold-ingot"]          = {1,4,10},
							["tnt"]                 = {1,2,5},
						}
					},
					{
						rolls = {1,3},
						items = {
							["emerald"]             = {4,8,5},
							["diamond"]             = {1,2,5},
							["prismarine-crystals"] = {1,5,5},
						}
					},
					{
						rolls = {0,1},
						items = {
							["leather-tunic"]       = {1,1,1},
							["iron-sword"]          = {1,1,1},
						}
					},
					{
						rolls = {2,2},
						items = {
							["cooked-cod"]          = {2,4,1},
							["cooked-salmon"]       = {2,4,1},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,1},
						items = {
							["heart-of-the-sea"]    = {1,1,1},
						}
					},
					{
						rolls = {5,12},
						items = {
							["prismarine-crystals"] = {1,5,5},
							["iron-ingot"]          = {3,5,20},
							["gold-ingot"]          = {1,5,10},
							["tnt"]                 = {1,2,10},
							["diamond"]             = {1,1,15},
							["disc-wait"]           = {1,1,5},
							["disc-mellohi"]        = {1,1,5},
							["name-tag"]            = {1,1,10},
							["chainmail-chestplate"] = {1,1,20},
							["chainmail-helmet"]    = {1,1,20},
							["chainmail-leggings"]  = {1,1,20},
							["chainmail-boots"]     = {1,1,20},
							["book-and-quill"]      = {1,2,5},
							["lead"]                = {1,3,10},
							["bottle-o'-enchanting"] = {1,1,3},
							["potion-of-water-breathing"] = {1,1,15},
							["potion-of-regeneration"] = {1,1,10},
							["cake"]                = {1,1,1},
						}
					},
				},
			}
		},
		
		["underwater-ruin-big"] = { -- underwater_ruin_big.json
			chest_table_display = { header="Big", superheader="[[Underwater ruins]]" },
			item_table_display  = { structure_id="underwater-ruins", structure_text="Underwater ruins", container="Big chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,8},
						items = {
							["coal"]                = {1,4,10},
							["gold-nugget"]         = {1,3,10},
							["emerald"]             = {1,1,1},
							["wheat"]               = {2,3,10},
						}
					},
					{
						rolls = {1,1},
						items = {
							["golden-apple"]        = {1,1,1},
							["enchanted-book-rnd"]  = {1,1,5},
							["leather-tunic"]       = {1,1,1},
							["golden-helmet"]       = {1,1,1},
							["enchanted-fishing-rod"] = {1,1,5},
							["buried-treasure-map"] = {1,1,10},
						}
					},
				},
			}
		},
		
		["underwater-ruin-small"] = { -- underwater_ruin_small.json
			chest_table_display = { header="Small", superheader="[[Underwater ruins]]" },
			item_table_display  = { structure_id="underwater-ruins", structure_text="Underwater ruins", container="Small chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,8},
						items = {
							["coal"]                = {1,4,10},
							["stone-axe"]           = {1,1,2},
							["rotten-flesh"]        = {1,1,5},
							["emerald"]             = {1,1,1},
							["wheat"]               = {2,3,10},
						}
					},
					{
						rolls = {1,1},
						items = {
							["leather-tunic"]       = {1,1,1},
							["golden-helmet"]       = {1,1,1},
							["enchanted-fishing-rod"] = {1,1,5},
							["buried-treasure-map"] = {1,1,5},
						}
					},
				},
			}
		},
		
		["village-armorer"] = { -- village\village_armorer.json
			chest_table_display = { header="Armorer", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Armorer's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["iron-ingot"]     = {1,3,2},
							["bread"]          = {1,4,4},
							["iron-helmet"]    = {1,1,1},
							["emerald"]        = {1,1,1}
						}
					},
				},
			},
		},
		
		["village-butcher"] = { -- village\village_butcher.json
			chest_table_display = { header="Butcher", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Butcher's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["emerald"]        = {1,1,1},
							["raw-porkchop"]   = {1,3,6},
							["wheat"]          = {1,3,6},
							["raw-beef"]       = {1,3,6},
							["raw-mutton"]     = {1,3,6},
							["coal"]           = {1,3,3}
						}
					},
				},
			},
		},
		
		["village-cartographer"] = { -- village\village_cartographer.json
			chest_table_display = { header="Cartographer", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Cartographer's chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,5},
						items = {
							["empty-map"]      = {1,3,10},
							["paper"]          = {1,5,15},
							["compass"]        = {1,1,5},
							["bread"]          = {1,4,15},
							["stick"]          = {1,2,5}
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,5},
						items = {
							["map"]            = {1,3,10},
							["paper"]          = {1,5,15},
							["compass"]        = {1,1,5},
							["bread"]          = {1,4,15},
							["oak-sapling"]    = {1,2,5}
						}
					},
				},
			},
		},
		
		["village-fisherman"] = { -- village\village_fisher.json, Java-exclusive as of Java 1.14 / Bedrock 1.12
			chest_table_display = { header="Fisherman", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Fisherman's chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,5},
						items = {
							["emerald"]         = {1,1,1},
							["raw-cod"]         = {1,3,2},
							["raw-salmon"]      = {1,3,1},
							["water-bucket"]    = {1,3,1},
							["barrel"]          = {1,3,1},
							["wheat-seeds"]     = {1,3,3},
							["coal"]            = {1,3,2}
						}
					},
				},
			},
		},
		
		["village-fletcher"] = { -- village\village_fletcher.json
			chest_table_display = { header="Fletcher", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Fletcher's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["emerald"]         = {1,1,1},
							["arrow"]           = {1,3,2},
							["feather"]         = {1,3,6},
							["egg"]             = {1,3,2},
							["flint"]           = {1,3,6},
							["stick"]           = {1,3,6}
						}
					},
				},
			},
		},
		
		["village-mason"] = { -- village\village_mason.json
			chest_table_display = { header="Mason", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Mason's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["clay"]           = {1,3,1},
							["flower-pot"]     = {1,1,1},
							["stone"]          = {1,1,2},
							["stone-bricks"]   = {1,1,2},
							["bread"]          = {1,4,4},
							["yellow-dye"]     = {1,1,1},
							["smooth-stone"]   = {1,1,1},
							["emerald"]        = {1,1,1}
						}
					},
				},
			},
		},
		
		["village-shepherd"] = { -- village\village_shepherd.json
			chest_table_display = { header="Shepherd", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Shepherd's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["white-wool"]      = {1,8,6},
							["black-wool"]      = {1,3,3},
							["gray-wool"]       = {1,3,2},
							["brown-wool"]      = {1,3,2},
							["light-gray-wool"] = {1,3,2},
							["emerald"]         = {1,1,1},
							["shears"]          = {1,1,1},
							["wheat"]           = {1,6,6}
						}
					},
				},
			},
		},
		
		["village-tannery"] = { -- village\village_tannery.json
			chest_table_display = { header="Tannery", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Tanner's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,5},
						items = {
							["leather"]         = {1,3,1},
							["leather-tunic"]   = {1,1,2},
							["leather-boots"]   = {1,1,2},
							["leather-cap"]     = {1,1,2},
							["bread"]           = {1,4,5},
							["leather-pants"]   = {1,1,2},
							["saddle"]          = {1,1,1},
							["emerald"]         = {1,4,1}
						}
					},
				},
			},
		},
		
		["village-temple"] = { -- village\village_temple.json
			chest_table_display = { header="Temple", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Temple chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["redstone"]        = {1,4,2},
							["bread"]           = {1,4,7},
							["rotten-flesh"]    = {1,4,7},
							["lapis-lazuli"]    = {1,4,1},
							["gold-ingot"]      = {1,4,1},
							["emerald"]         = {1,4,1}
						}
					},
				},
			},
		},
		
		["village-toolsmith"] = { -- village\village_toolsmith.json
			chest_table_display = { header="Toolsmith", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Toolsmith's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["diamond"]         = {1,3,1},
							["iron-ingot"]      = {1,5,5},
							["gold-ingot"]      = {1,3,1},
							["bread"]           = {1,3,15},
							["iron-pickaxe"]    = {1,1,5},
							["coal"]            = {1,3,1},
							["stick"]           = {1,3,20},
							["iron-shovel"]     = {1,1,5}
						}
					},
				},
			},
		},
		
		["village-weaponsmith"] = { -- village\village_weaponsmith.json
			chest_table_display = { header="Weaponsmith", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Weaponsmith's chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["diamond"]             = {1,3,3},
							["iron-ingot"]          = {1,5,10},
							["gold-ingot"]          = {1,3,5},
							["bread"]               = {1,3,15},
							["apple"]               = {1,3,15},
							["iron-pickaxe"]        = {1,1,5},
							["iron-sword"]          = {1,1,5},
							["iron-chestplate"]     = {1,1,5},
							["iron-helmet"]         = {1,1,5},
							["iron-leggings"]       = {1,1,5},
							["iron-boots"]          = {1,1,5},
							["obsidian"]            = {3,7,5},
							["oak-sapling"]         = {3,7,5},
							["saddle"]              = {1,1,3},
							["iron-horse-armor"]    = {1,1,1},
							["golden-horse-armor"]  = {1,1,1},
							["diamond-horse-armor"] = {1,1,1}
						}
					},
				},
			},
		},
		
		["village-desert-house"] = { -- village\village_desert_house.json
			chest_table_display = { header="Desert House", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Desert house chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["clay"]            = {1,1,1},
							["green-dye"]       = {1,1,1},
							["cactus"]          = {1,4,10},
							["wheat"]           = {1,7,10},
							["bread"]           = {1,4,10},
							["book"]            = {1,1,1},
							["dead-bush"]       = {1,3,2},
							["emerald"]         = {1,3,1}
						}
					},
				},
			},
		},
		
		["village-plains-house"] = { -- village\village_plains_house.json
			chest_table_display = { header="Plains house", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Plains house chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["gold-nugget"]     = {1,3,1},
							["dandelion"]       = {1,1,2},
							["poppy"]           = {1,1,1},
							["potato"]          = {1,7,10},
							["bread"]           = {1,4,10},
							["apple"]           = {1,5,10},
							["book"]            = {1,1,1},
							["feather"]         = {1,1,1},
							["emerald"]         = {1,4,2},
							["oak-sapling"]     = {1,2,5}
						}
					},
				},
			},
		},
		
		["village-savanna-house"] = { -- village\village_savanna_house.json
			chest_table_display = { header="Savanna House", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Savanna house chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["gold-nugget"]     = {1,3,1},
							["grass"]           = {1,1,5},
							["tall-grass"]      = {1,1,5},
							["bread"]           = {1,4,10},
							["wheat-seeds"]     = {1,5,10},
							["emerald"]         = {1,4,2},
							["acacia-sapling"]  = {1,2,10},
							["saddle"]          = {1,1,1},
							["torch"]           = {1,2,1},
							["bucket"]          = {1,1,1}
						}
					},
				},
			},
		},
		
		["village-snowy-house"] = { -- village\village_snowy_house.json
			chest_table_display = { header="Snowy House", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Snowy house chest" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {3,8},
						items = {
							["blue-ice"]        = {1,1,1},
							["snow-block"]      = {1,1,4},
							["potato"]          = {1,7,10},
							["bread"]           = {1,4,10},
							["beetroot-seeds"]  = {1,5,10},
							["beetroot-soup"]   = {1,1,1},
							["furnace"]         = {1,1,1},
							["emerald"]         = {1,4,1},
							["snowball"]        = {1,7,10},
							["coal"]            = {1,4,5}
						}
					},
				},
			},
		},
		
		["village-taiga-house"] = { -- village\village_taiga_house.json
			chest_table_display = { header="Taiga House", superheader="[[Village]]" },
			item_table_display  = { structure_id="village", structure_text="Village", container="Taiga house chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {3,8},
						items = {
							["iron-nugget"]     = {1,5,1},
							["fern"]            = {1,1,2},
							["large-fern"]      = {1,1,2},
							["potato"]          = {1,7,10},
							["sweet-berries"]   = {1,7,5},
							["bread"]           = {1,4,10},
							["pumpkin-seeds"]   = {1,5,5},
							["pumpkin-pie"]     = {1,1,1},
							["emerald"]         = {1,4,2},
							["spruce-sapling"]  = {1,5,5},
							["spruce-sign"]     = {1,1,1},
							["spruce-log"]      = {1,5,10}
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {3,8},
						items = {
							["iron-nugget"]     = {1,5,1},
							["fern"]            = {1,1,2},
							["large-fern"]      = {1,1,2},
							["potato"]          = {1,7,10},
							["bread"]           = {1,4,10},
							["pumpkin-seeds"]   = {1,5,5},
							["pumpkin-pie"]     = {1,1,1},
							["emerald"]         = {1,4,2},
							["spruce-sapling"]  = {1,5,5},
							["oak-sign"]        = {1,1,1},
							["spruce-log"]      = {1,5,10}
						}
					},
				},
			},
		},
		
		["stronghold-altar"] = { -- stronghold_corridor.json
			chest_table_display = { header="Altar", superheader="[[Stronghold]]" },
			item_table_display  = { structure_id="stronghold", structure_text="Stronghold", container="Altar chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {2,3},
						items = {
							["ender-pearl"]         = {1,1,10},
							["diamond"]             = {1,3,3},
							["iron-ingot"]          = {1,5,10},
							["gold-ingot"]          = {1,3,5},
							["redstone"]            = {4,9,5},
							["bread"]               = {1,3,15},
							["apple"]               = {1,3,15},
							["iron-pickaxe"]        = {1,1,5},
							["iron-sword"]          = {1,1,5},
							["iron-chestplate"]     = {1,1,5},
							["iron-helmet"]         = {1,1,5},
							["iron-leggings"]       = {1,1,5},
							["iron-boots"]          = {1,1,5},
							["golden-apple"]        = {1,1,1},
							["saddle"]              = {1,1,1},
							["iron-horse-armor"]    = {1,1,1},
							["golden-horse-armor"]  = {1,1,1},
							["diamond-horse-armor"] = {1,1,1},
							["enchanted-book"]      = {1,1,1},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {2,3},
						items = {
							["ender-pearl"]         = {1,1,50},
							["emerald"]             = {1,3,15},
							["diamond"]             = {1,3,15},
							["iron-ingot"]          = {1,5,50},
							["gold-ingot"]          = {1,3,25},
							["redstone"]            = {4,9,25},
							["bread"]               = {1,3,75},
							["apple"]               = {1,3,75},
							["iron-pickaxe"]        = {1,1,25},
							["iron-sword"]          = {1,1,25},
							["iron-chestplate"]     = {1,1,25},
							["iron-helmet"]         = {1,1,25},
							["iron-leggings"]       = {1,1,25},
							["iron-boots"]          = {1,1,25},
							["golden-apple"]        = {1,1,5},
							["saddle"]              = {1,1,5},
							["iron-horse-armor"]    = {1,1,5},
							["golden-horse-armor"]  = {1,1,5},
							["diamond-horse-armor"] = {1,1,5},
							["enchanted-book"]      = {1,1,6},
						}
					},
				},
			},
		},
		
		["stronghold-library"] = { -- stronghold_library.json
			chest_table_display = { header="Library", superheader="[[Stronghold]]" },
			item_table_display  = { structure_id="stronghold", structure_text="Stronghold", container="Library chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {2,10},
						items = {
							["book"]                = {1,3,20},
							["paper"]               = {2,7,20},
							["empty-map"]           = {1,1,1},
							["compass"]             = {1,1,1},
							["enchanted-book"]      = {1,1,10},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {2,10},
						items = {
							["book"]                = {1,3,100},
							["paper"]               = {2,7,100},
							["map"]                 = {1,1,5},
							["compass"]             = {1,1,5},
							["enchanted-book"]      = {1,1,60},
						}
					},
				},
			},
		},
		
		["stronghold-storeroom"] = { -- stronghold_crossing.json
			chest_table_display = { header="Storeroom", superheader="[[Stronghold]]" },
			item_table_display  = { structure_id="stronghold", structure_text="Stronghold", container="Storeroom chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,4},
						items = {
							["iron-ingot"]          = {1,5,10},
							["gold-ingot"]          = {1,3,5},
							["redstone"]            = {4,9,5},
							["coal"]                = {3,8,10},
							["bread"]               = {1,3,15},
							["apple"]               = {1,3,15},
							["iron-pickaxe"]        = {1,1,1},
							["enchanted-book"]      = {1,1,1},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,4},
						items = {
							["iron-ingot"]          = {1,5,50},
							["gold-ingot"]          = {1,3,25},
							["redstone"]            = {4,9,25},
							["coal"]                = {3,8,50},
							["bread"]               = {1,3,75},
							["apple"]               = {1,3,75},
							["iron-pickaxe"]        = {1,1,5},
							["enchanted-book"]      = {1,1,6},
							["ink-sac"]             = {1,3,75},
						}
					},
				},
			},
		},
		
		["bonus"] = { -- spawn_bonus_chest.json
			chest_table_display = { header="[[Chest#Bonus chest|Bonus]]" },
			item_table_display  = { structure_id="day", structure_text="Bonus chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,1},
						items = {
							["stone-axe"]           = {1,1,1},
							["wooden-axe"]          = {1,1,3},
						}
					},
					{
						rolls = {1,1},
						items = {
							["stone-pickaxe"]       = {1,1,1},
							["wooden-pickaxe"]      = {1,1,3}
						}
					},
					{
						rolls = {3,3},
						items = {
							["apple"]               = {1,2,5},
							["bread"]               = {1,2,3},
							["raw-salmon"]          = {1,2,3},
						}
					},
					{
						rolls = {4,4},
						items = {
							["stick"]               = {1,12,10},
							["oak-planks"]          = {1,12,10},
							["oak-log"]             = {1,3,3},
							["spruce-log"]          = {1,3,3},
							["birch-log"]           = {1,3,3},
							["jungle-log"]          = {1,3,3},
							["acacia-log"]          = {1,3,3},
							["dark-oak-log"]        = {1,3,3},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,1},
						items = {
							["stone-axe"]           = {1,1,1},
							["wooden-axe"]          = {1,1,3},
						}
					},
					{
						rolls = {1,1},
						items = {
							["stone-pickaxe"]       = {1,1,1},
							["wooden-pickaxe"]      = {1,1,3}
						}
					},
					{
						rolls = {1,1},
						items = {
							["apple"]               = {1,2,1}
						}
					},
					{
						rolls = {1,1},
						items = {
							["bread"]               = {1,2,1}
						}
					},
					{
						rolls = {1,1},
						items = {
							["raw-salmon"]          = {1,2,1}
						}
					},
					{
						rolls = {1,1},
						items = {
							["stick"]               = {1,12,1}
						}  
					},
					{
						rolls = {1,1},
						items = {
							["oak-planks"]          = {1,12,1}
						}  
					},
					{
						rolls = {1,1},
						items = {
							["dark-oak-log"]        = {1,3,1},
							["acacia-log"]          = {1,3,1},
						}
					},
					{
						rolls = {1,1},
						items = {
							["oak-log"]             = {1,3,1},
							["spruce-log"]          = {1,3,1},
							["birch-log"]           = {1,3,1},
							["jungle-log"]          = {1,3,1},
						}
					},
					{
						rolls = {1,1},
						items = {
							["potato"]              = {1,2,3},
							["carrot"]              = {1,2,3},
						}
					},
					{
						rolls = {1,1},
						items = {
							["oak-sapling"]         = {4,4,2},
							["spruce-sapling"]      = {4,4,2},
							["birch-sapling"]       = {4,4,2},
							["jungle-sapling"]      = {4,4,4},
							["dark-oak-sapling"]    = {4,4,2},
							["acacia-sapling"]      = {4,4,2},
						}
					},
					{
						rolls = {1,1},
						items = {
							["melon-seeds"]         = {1,2,3},
							["pumpkin-seeds"]       = {1,2,3},
							["beetroot-seeds"]      = {1,2,3},
						}
					},
					{
						rolls = {1,1},
						items = {
							["cactus"]              = {1,2,3},
							["cocoa-beans"]         = {1,2,2},
						}
					},
					{
						rolls = {1,1},
						items = {
							["brown-mushroom"]              = {1,2,2},
						}
					},
				},
			},
		},
		
		["dungeon"] = { -- simple_dungeon.json
			chest_table_display = { header="[[Dungeon]]" },
			item_table_display  = { structure_id="dungeon", structure_text="Dungeon" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,3},
						items = {
							["saddle"]              = {1,1,20},
							["golden-apple"]        = {1,1,15},
							["enchanted-golden-apple"] = {1,1,2},
							["disc-13"]             = {1,1,15},
							["disc-cat"]            = {1,1,15},
							["name-tag"]            = {1,1,20},
							["golden-horse-armor"]  = {1,1,10},
							["iron-horse-armor"]    = {1,1,15},
							["diamond-horse-armor"] = {1,1,5},
							["enchanted-book-rnd"]  = {1,1,10},
						}
					},
					{
						rolls = {1,4},
						items = {
							["iron-ingot"]          = {1,4,10},
							["gold-ingot"]          = {1,4,5},
							["bread"]               = {1,1,20},
							["wheat"]               = {1,4,20},
							["bucket"]              = {1,1,10},
							["redstone"]            = {1,4,15},
							["coal"]                = {1,4,15},
							["melon-seeds"]         = {2,4,10},
							["pumpkin-seeds"]       = {2,4,10},
							["beetroot-seeds"]      = {2,4,10},
						}
					},
					{
						rolls = {3,3},
						items = {
							["bone"]                = {1,8,10},
							["gunpowder"]           = {1,8,10},
							["rotten-flesh"]        = {1,8,10},
							["string"]              = {1,8,10},
						}
					},
				},
			},
		},
		
		["mineshaft"] = { -- abandoned_mineshaft.json
			chest_table_display = { header="[[Mineshaft]]" },
			item_table_display  = { structure_id="abandoned-mineshaft", structure_text="Mineshaft" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {1,1},
						items = {
							["golden-apple"]        = {1,1,20},
							["enchanted-golden-apple"] = {1,1,1},
							["name-tag"]            = {1,1,30},
							["enchanted-book-rnd"]  = {1,1,10},
							["iron-pickaxe"]        = {1,1,5},
							["empty"]				= {1,1,5},
						}
					},
					{
						rolls = {2,4},
						items = {
							["iron-ingot"]          = {1,5,10},
							["gold-ingot"]          = {1,3,5},
							["redstone"]            = {4,9,5},
							["lapis-lazuli"]        = {4,9,5},
							["diamond"]             = {1,2,3},
							["coal"]                = {3,8,10},
							["bread"]               = {1,3,15},
							["melon-seeds"]         = {2,4,10},
							["pumpkin-seeds"]       = {2,4,10},
							["beetroot-seeds"]      = {2,4,10},
						}
					},
					{
						rolls = {3,3},
						items = {
							["rail"]                = {4,8,20},
							["powered-rail"]        = {1,4,5},
							["detector-rail"]       = {1,4,5},
							["activator-rail"]      = {1,4,5},
							["torch"]               = {1,16,15},
						}
					},
				},
			},
		},
		
		["nether-fortress"] = { -- nether_bridge.json
			chest_table_display = { header="[[Nether fortress]]" },
			item_table_display  = { structure_id="nether-fortress", structure_text="Nether fortress" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,4},
						items = {
							["diamond"]             = {1,3,5},
							["iron-ingot"]          = {1,5,5},
							["gold-ingot"]          = {1,3,15},
							["golden-sword"]        = {1,1,5},
							["golden-chestplate"]   = {1,1,5},
							["flint-and-steel"]     = {1,1,5},
							["nether-wart"]         = {3,7,5},
							["saddle"]              = {1,1,10},
							["golden-horse-armor"]    = {1,1,8},
							["iron-horse-armor"]    = {1,1,5},
							["diamond-horse-armor"] = {1,1,3},
							["obsidian"]            = {2,4,2},
						}
					},
				},
			},
		},
		
		["desert-temple"] = { -- desert_pyramid.json
			chest_table_display = { header="[[Desert temple]]" },
			item_table_display  = { structure_id="desert-temple", structure_text="Desert temple" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,4},
						items = {
							["diamond"]             = {1,3,5},
							["iron-ingot"]          = {1,5,15},
							["gold-ingot"]          = {2,7,15},
							["emerald"]             = {1,3,15},
							["bone"]                = {4,6,25},
							["spider-eye"]          = {1,3,25},
							["rotten-flesh"]        = {3,7,25},
							["saddle"]              = {1,1,20},
							["iron-horse-armor"]    = {1,1,15},
							["golden-horse-armor"]  = {1,1,10},
							["diamond-horse-armor"] = {1,1,5},
							["enchanted-book-rnd"]  = {1,1,20},
							["golden-apple"]        = {1,1,20},
							["enchanted-golden-apple"] = {1,1,2},
							["empty"]               = {1,1,15},
						}
					},
					{
						rolls = {4,4},
						items = {
							["bone"]                = {1,8,10},
							["gunpowder"]           = {1,8,10},
							["rotten-flesh"]        = {1,8,10},
							["string"]              = {1,8,10},
							["sand"]                = {1,8,10},
						}
					},
				},
			},
		},
		
		["jungle-temple"] = { -- jungle_temple.json
			chest_table_display = { header="Chest", superheader="[[Jungle temple]]" },
			item_table_display  = { structure_id="jungle-temple", structure_text="Jungle temple", container="Chest" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {2,6},
						items = {
							["diamond"]             = {1,3,3},
							["iron-ingot"]          = {1,5,10},
							["gold-ingot"]          = {2,7,15},
							["emerald"]             = {1,3,2},
							["bone"]                = {4,6,20},
							["bamboo"]              = {1,3,15},
							["rotten-flesh"]        = {3,7,16},
							["saddle"]              = {1,1,3},
							["iron-horse-armor"]    = {1,1,1},
							["golden-horse-armor"]  = {1,1,1},
							["diamond-horse-armor"] = {1,1,1},
							["enchanted-book"]      = {1,1,1}
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {2,6},
						items = {
							["diamond"]             = {1,3,15},
							["iron-ingot"]          = {1,5,50},
							["gold-ingot"]          = {2,7,75},
							["emerald"]             = {1,3,10},
							["bone"]                = {4,6,100},
							["rotten-flesh"]        = {3,7,80},
							["bamboo"]              = {1,3,75},
							["saddle"]              = {1,1,15},
							["iron-horse-armor"]    = {1,1,5},
							["golden-horse-armor"]  = {1,1,5},
							["diamond-horse-armor"] = {1,1,5},
							["enchanted-book"]      = {1,1,6}
						}
					},
				},
			},
		},
		
		["jungle-temple-dispenser"] = { -- jungle_temple_dispenser.json
			chest_table_display = { header="Dispenser", superheader="[[Jungle temple]]" },
			item_table_display  = { structure_id="jungle-temple", structure_text="Jungle temple", container="Dispenser" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,2},
						items = {
							["arrow"] = {2,7,30}
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {2,2},
						items = {
							["arrow"] = {2,7,30}
						}
					},
				},
			},
		},
		
		["end-city"] = { -- end_city_treasure.json
			chest_table_display = { header="[[End city]]" },
			item_table_display  = { structure_id="end-city", structure_text="End city" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,6},
						items = {
							["diamond"]             = {2,7,5},
							["iron-ingot"]          = {4,8,10},
							["gold-ingot"]          = {2,7,15},
							["emerald"]             = {2,6,2},
							["beetroot-seeds"]      = {1,10,5},
							["saddle"]              = {1,1,3},
							["iron-horse-armor"]    = {1,1,1},
							["golden-horse-armor"]  = {1,1,1},
							["diamond-horse-armor"] = {1,1,1},
							["level-enchanted-diamond-sword"]      = {1,1,3},
							["level-enchanted-diamond-boots"]      = {1,1,3},
							["level-enchanted-diamond-chestplate"] = {1,1,3},
							["level-enchanted-diamond-leggings"]   = {1,1,3},
							["level-enchanted-diamond-helmet"]     = {1,1,3},
							["level-enchanted-diamond-pickaxe"]    = {1,1,3},
							["level-enchanted-diamond-shovel"]     = {1,1,3},
							["level-enchanted-iron-sword"]         = {1,1,3},
							["level-enchanted-iron-boots"]         = {1,1,3},
							["level-enchanted-iron-chestplate"]    = {1,1,3},
							["level-enchanted-iron-leggings"]      = {1,1,3},
							["level-enchanted-iron-helmet"]        = {1,1,3},
							["level-enchanted-iron-pickaxe"]       = {1,1,3},
							["level-enchanted-iron-shovel"]        = {1,1,3},
						}
					},
				},
			},
		},
		
		["igloo"] = {
			chest_table_display = { header="[[Igloo]]" },
			item_table_display  = { structure_id="igloo", structure_text="Igloo" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {2,8},
						items = {
							["apple"]               = {1,3,15},
							["coal"]                = {1,4,15},
							["gold-nugget"]         = {1,3,10},
							["stone-axe"]           = {1,1,2},
							["rotten-flesh"]        = {1,1,10},
							["emerald"]             = {1,1,1},
							["wheat"]               = {2,3,10}
						}
					},
					{
						rolls = {1,1},
						items = {
							["golden-apple"]        = {1,1,1},
						}
					},
				},
			},
		},
		
		["pillager-outpost"] = {
			chest_table_display = { header="[[Pillager outpost]]" },
			item_table_display  = { structure_id="pillager-outpost", structure_text="Pillager outpost" },
			loot_tables = {
				{
					{"java","bedrock"},
					{
						rolls = {0,1},
						items = {
							["crossbow"]             = {1,1,1},
						}
					},
					{
						rolls = {2,3},
						items = {
							["wheat"]                = {3,5,7},
							["potato"]               = {2,5,5},
							["carrot"]               = {3,5,5}
						}
					},
					{
						rolls = {1,3},
						items = {
							["dark-oak-log"]         = {2,3,1}
						}
					},
					{
						rolls = {2,3},
						items = {
							["bottle-o'-enchanting"] = {1,1,7},
							["string"]               = {1,6,4},
							["arrow"]                = {2,7,4},
							["tripwire-hook"]        = {1,3,3},
							["iron-ingot"]           = {1,3,3},
							["enchanted-book-rnd"]   = {1,1,1}
						}
					},
				},
			},
		},
		
		["bastion-bridge"] = { -- bastion_bridge.json
			chest_table_display = { header="Bridge", superheader="[[Bastion remnant]]" },
			item_table_display  = { structure_id="bastion-remnant", structure_text="Bastion remnant", container="Bridge chest" },
			loot_tables = {
				{
					{"java-upcoming"},
					{
						rolls = {1,1},
						items = {
							["lodestone"] = {1,1,1},
						}
					},
					{
						rolls = {1,2},
						items = {
							["damaged-random-enchanted-crossbow"] = {1,1,1},
							["spectral-arrow"] = {2,12,1},
							["gilded-blackstone"] = {5,8,1},
							["crying-obsidian"] = {3,8,1},
							["block-of-gold"] = {1,1,1},
							["gold-ingot"] = {2,8,1},
							["iron-ingot"] = {2,8,1},
							["golden-sword"] = {1,1,1},
							["random-enchanted-golden-chestplate"] = {1,1,1},
							["random-enchanted-golden-helmet"] = {1,1,1},
							["random-enchanted-golden-leggings"] = {1,1,1},
							["random-enchanted-golden-boots"] = {1,1,1},
						}
					},
					{
						rolls = {2,4},
						items = {
							["string"] = {1,6,1},
							["leather"] = {1,3,1},
							["arrow"] = {5,17,1},
							["iron-nugget"] = {2,6,1},
							["gold-nugget"] = {2,6,1},
						}
					}
				},
				{
					{"bedrock-upcoming"},
					{
						rolls = {1,1},
						items = {
							["lodestone"] = {1,1,1},
						}
					},
					{
						rolls = {1,2},
						items = {
							["arrow"] = {5,18,1},
							["gilded-blackstone"] = {5,10,1},
							["crying-obsidian"] = {3,8,1},
							["block-of-gold"] = {1,1,1},
							["gold-ingot"] = {2,8,1},
							["iron-ingot"] = {2,8,1},
							["golden-sword"] = {1,1,1},
							["random-enchanted-golden-chestplate"] = {1,1,1},
							["random-enchanted-golden-helmet"] = {1,1,1},
							["random-enchanted-golden-leggings"] = {1,1,1},
							["random-enchanted-golden-boots"] = {1,1,1},
						}
					},
					{
						rolls = {2,4},
						items = {
							["string"] = {1,6,1},
							["leather"] = {1,3,1},
							["arrow"] = {5,17,1},
							["iron-nugget"] = {2,6,1},
							["gold-nugget"] = {2,6,1}
						}
					}
				},
			},
		},
		
		["bastion-hoglin-stable"] = { -- bastion_hoglin_stable.json
			chest_table_display = { header="Hoglin stable", superheader="[[Bastion remnant]]" },
			item_table_display  = { structure_id="bastion-remnant", structure_text="Bastion remnant", container="Hoglin stable chest" },
			loot_tables = {
				{
					{"java-upcoming"},
					{
						rolls = {1,1},
						items = {
							["damaged-random-enchanted-diamond-shovel"] = {1,1,5},
							["netherite-scrap"] = {1,1,2},
							["ancient-debris"] = {1,1,3},
							["saddle"] = {1,1,10},
							["block-of-gold"] = {2,4,25},
							["random-enchanted-golden-hoe"] = {1,1,15},
							["empty"] = {1,1,45},
						}
					},
					{
						rolls = {3,4},
						items = {
							["glowstone"] = {1,5,1},
							["gilded-blackstone"] = {1,5,1},
							["soul-sand"] = {2,7,1},
							["crimson-nylium"] = {2,7,1},
							["gold-nugget"] = {2,8,1},
							["leather"] = {1,3,1},
							["arrow"] = {5,17,1},
							["string"] = {3,8,1},
							["raw-porkchop"] = {2,5,1},
							["cooked-porkchop"] = {2,5,1},
							["crimson-fungus"] = {2,7,1},
							["crimson-roots"] = {2,7,1},
						}
					},
				},
				{
					{"bedrock-upcoming"},
					{
						rolls = {1,1},
						items = {
							["damaged-random-enchanted-netherite-shovel"] = {1,1,10},
							["netherite-scrap"] = {1,1,10},
							["ancient-debris"] = {1,1,10},
							["saddle"] = {1,1,15},
							["block-of-gold"] = {2,4,10},
							["random-enchanted-golden-hoe"] = {1,1,10},
							["empty"] = {1,1,10}
						}
					},
					{
						rolls = {3,4},
						items = {
							["glowstone"] = {1,5,1},
							["gilded-blackstone"] = {1,5,1},
							["soul-sand"] = {2,7,1},
							["crimson-nylium"] = {2,7,1},
							["gold-nugget"] = {2,8,1},
							["leather"] = {1,3,1},
							["arrow"] = {5,17,1},
							["string"] = {3,8,1},
							["raw-porkchop"] = {2,5,1},
							["cooked-porkchop"] = {2,5,1},
							["crimson-fungus"] = {2,7,1},
							["crimson-roots"] = {2,7,1}
						}
					}
				},
			},
		},
		
		["bastion-other"] = { -- bastion_other.json
			chest_table_display = { header="Other", superheader="[[Bastion remnant]]" },
			item_table_display  = { structure_id="bastion-remnant", structure_text="Bastion remnant", container="Other chest" },
			loot_tables = {
				{
					{"java-upcoming"},
					{
						rolls = {1,1},
						items = {
							["damaged-random-enchanted-crossbow"] = {1,1,12},
							["ancient-debris"] = {1,1,2},
							["netherite-scrap"] = {1,1,2},
							["spectral-arrow"] = {2,15,6},
							["snout-banner-pattern"] = {1,1,5},
							["disc-pigstep"] = {1,1,3},
							["enchanted-book-rnd-soul-speed"] = {1,1,10},
							["empty"] = {1,1,50},
						}
					},
					{
						rolls = {2,2},
						items = {
							["soul-speed-enchanted-golden-boots"] = {1,1,1},
							["block-of-gold"] = {1,1,1},
							["crossbow"] = {1,1,1},
							["gold-ingot"] = {1,6,1},
							["iron-ingot"] = {1,6,1},
							["golden-sword"] = {1,1,1},
							["golden-chestplate"] = {1,1,1},
							["golden-helmet"] = {1,1,1},
							["golden-leggings"] = {1,1,1},
							["golden-boots"] = {1,1,1},
							["empty"] = {1,1,2},
						}
					},
					{
						rolls = {3,5},
						items = {
							["crying-obsidian"] = {1,5,1},
							["gilded-blackstone"] = {1,5,1},
							["chain"] = {2,10,1},
							["magma-cream"] = {2,6,1},
							["bone-block"] = {3,6,1},
							["iron-nugget"] = {2,8,1},
							["obsidian"] = {4,6,1},
							["gold-nugget"] = {2,8,1},
							["string"] = {4,6,1},
							["arrow"] = {5,17,2},
						}
					},
				},
				{
					{"bedrock-upcoming"},
					{
						rolls = {1,1},
						items = {
							["damaged-random-enchanted-crossbow"] = {1,1,10},
							["ancient-debris"] = {1,1,5},
							["netherite-scrap"] = {1,1,5},
							["arrow"] = {5,20,10},
							["snout-banner-pattern"] = {1,1,10},
							["disc-pigstep"] = {1,1,10},
							["empty"] = {1,1,10},
						}
					},
					{
						rolls = {2,2},
						items = {
							["enchanted-book-rnd-soul-speed"] = {1,1,1},
							["soul-speed-enchanted-golden-boots"] = {1,1,1},
							["block-of-gold"] = {1,1,1},
							["crossbow"] = {1,1,1},
							["gold-ingot"] = {1,6,1},
							["iron-ingot"] = {1,6,1},
							["golden-sword"] = {1,1,1},
							["golden-chestplate"] = {1,1,1},
							["golden-helmet"] = {1,1,1},
							["golden-leggings"] = {1,1,1},
							["golden-boots"] = {1,1,1},
							["empty"] = {1,1,2},
						}
					},
					{
						rolls = {3,5},
						items = {
							["crying-obsidian"] = {1,5,1},
							["gilded-blackstone"] = {1,5,1},
							["chain"] = {2,10,1},
							["magma-cream"] = {2,6,1},
							["bone-block"] = {3,6,1},
							["iron-nugget"] = {2,8,1},
							["obsidian"] = {4,6,1},
							["gold-nugget"] = {2,8,1},
							["string"] = {4,6,1},
							["arrow"] = {5,17,2},
						}
					}
				},
			},
		},
		
		["bastion-treasure"] = { -- bastion_treasure.json
			chest_table_display = { header="Treasure", superheader="[[Bastion remnant]]" },
			item_table_display  = { structure_id="bastion-remnant", structure_text="Bastion remnant", container="Treasure chest" },
			loot_tables = {
				{
					{"java-upcoming"},
					{
						rolls = {1,2},
						items = {
							["netherite-ingot"] = {1,1,10},
							["ancient-debris"] = {1,1,14},
							["netherite-scrap"] = {1,1,10},
							["ancient-debris"] = {2,2,1},
							["damaged-random-enchanted-diamond-sword"] = {1,1,10},
							["damaged-random-enchanted-diamond-chestplate"] = {1,1,6},
							["damaged-random-enchanted-diamond-helmet"] = {1,1,6},
							["damaged-random-enchanted-diamond-leggings"] = {1,1,6},
							["damaged-random-enchanted-diamond-boots"] = {1,1,6},
							["damaged-diamond-sword"] = {1,1,6}, 
							["damaged-diamond-chestplate"] = {1,1,5},
							["damaged-diamond-helmet"] = {1,1,5},
							["damaged-diamond-leggings"] = {1,1,5},
							["damaged-diamond-boots"] = {1,1,5},
							["diamond"] = {1,3,5},
						}
					},
					{
						rolls = {2,4},
						items = {
							["spectral-arrow"] = {5,21,1},
							["block-of-gold"] = {2,5,1},
							["gold-ingot"] = {3,9,1},
							["iron-ingot"] = {3,9,1},
							["crying-obsidian"] = {1,5,1},
							["nether-quartz"] = {8,23,1},
							["gilded-blackstone"] = {1,5,1},
							["magma-cream"] = {2,8,1},
							["iron-nugget"] = {8,16,1},
						}
					},
				},
				{
					{"bedrock-upcoming"},
					{
						rolls = {1,1},
						items = {
							["netherite-ingot"] = {1,1,10},
							["ancient-debris"] = {1,1,10},
							["netherite-scrap"] = {1,1,10},
							["ancient-debris"] = {2,2,5},
							["damaged-random-enchanted-netherite-sword"] = {1,1,10},
							["damaged-random-enchanted-netherite-chestplate"] = {1,1,6},
							["damaged-random-enchanted-netherite-helmet"] = {1,1,6},
							["damaged-random-enchanted-netherite-leggings"] = {1,1,6},
							["damaged-random-enchanted-netherite-boots"] = {1,1,6},
							["damaged-netherite-sword"] = {1,1,6},
							["damaged-netherite-chestplate"] = {1,1,5},
							["damaged-netherite-helmet"] = {1,1,5},
							["damaged-netherite-boots"] = {1,1,5},
							["damaged-netherite-leggings"] = {1,1,5},
							["diamond"] = {1,3,5},
						}
					},
					{
						rolls = {2,4},
						items = {
							["arrow"] = {5,21,1},
							["block-of-gold"] = {2,5,1},
							["gold-ingot"] = {3,9,1},
							["iron-ingot"] = {3,9,1},
							["crying-obsidian"] = {1,5,1},
							["nether-quartz"] = {8,23,1},
							["gilded-blackstone"] = {1,5,1},
							["magma-cream"] = {2,8,1},
							["iron-nugget"] = {8,16,1},
						}
					}
				},
			},
		},
		
		["ruined-portal"] = { --ruined_portal.json
			chest_table_display = { header="[[Ruined portal]]" },
			item_table_display  = { structure_id="ruined-portal", structure_text="Ruined portal" },
			loot_tables = {
				{
					{"java-upcoming"},
					{
						rolls = {4,8},
						items = {
							["obsidian"] = {1,2,40},
							["flint"] = {1,4,40},
							["iron-nugget"] = {9,18,40},
							["flint-and-steel"] = {1,1,40},
							["fire-charge"] = {1,1,40},
							["golden-apple"] = {1,1,15},
							["gold-nugget"] = {4,24,15},
							["random-enchanted-golden-sword"] = {1,1,15},
							["random-enchanted-golden-axe"] = {1,1,15},
							["random-enchanted-golden-hoe"] = {1,1,15},
							["random-enchanted-golden-shovel"] = {1,1,15},
							["random-enchanted-golden-pickaxe"] = {1,1,15},
							["random-enchanted-golden-helmet"] = {1,1,15},
							["random-enchanted-golden-chestplate"] = {1,1,15},
							["random-enchanted-golden-leggings"] = {1,1,15},
							["random-enchanted-golden-boots"] = {1,1,15},
							["glistering-melon-slice"] = {4,12,5},
							["golden-horse-armor"] = {1,1,5},
							["light-weighted-pressure-plate"] = {1,1,5},
							["golden-carrot"] = {4,12,5},
							["clock"] = {1,1,5},
							["gold-ingot"] = {2,8,5},
							["bell"] = {1,1,1},
							["enchanted-golden-apple"] = {1,1,1},
							["block-of-gold"] = {1,2,1},
						}
					},
				},
				{
					{"bedrock-upcoming"},
					{
						rolls = {4,8},
						items = {
							["obsidian"] = {1,2,40},
							["flint"] = {1,4,40},
							["iron-nugget"] = {9,18,40},
							["flint-and-steel"] = {1,1,40},
							["fire-charge"] = {1,1,40},
							["golden-apple"] = {1,1,15},
							["gold-nugget"] = {4,24,15},
							["random-enchanted-golden-sword"] = {1,1,15},
							["random-enchanted-golden-axe"] = {1,1,15},
							["random-enchanted-golden-hoe"] = {1,1,15},
							["random-enchanted-golden-shovel"] = {1,1,15},
							["random-enchanted-golden-pickaxe"] = {1,1,15},
							["random-enchanted-golden-helmet"] = {1,1,15},
							["random-enchanted-golden-chestplate"] = {1,1,15},
							["random-enchanted-golden-leggings"] = {1,1,15},
							["random-enchanted-golden-boots"] = {1,1,15},
							["glistering-melon-slice"] = {1,1,5},
							["golden-horse-armor"] = {1,1,5},
							["light-weighted-pressure-plate"] = {1,1,5},
							["golden-carrot"] = {4,12,5},
							["clock"] = {1,1,5},
							["gold-ingot"] = {2,8,5},
							["bell"] = {1,1,1},
							["enchanted-golden-apple"] = {1,1,1},
							["block-of-gold"] = {1,2,1},
						}
					},
				},
			},
		},
		
		["woodland-mansion"] = { -- woodland_mansion.json
			chest_table_display = { header="[[Woodland mansion]]" },
			item_table_display  = { structure_id="woodland-mansion", structure_text="Woodland mansion" },
			loot_tables = {
				{
					{"java"},
					{
						rolls = {1,3},
						items = {
							["lead"]                  = {1,1,20},
							["golden-apple"]          = {1,1,15},
							["enchanted-golden-apple"] = {1,1,2},
							["disc-13"]               = {1,1,15},
							["disc-cat"]              = {1,1,15},
							["name-tag"]              = {1,1,20},
							["chainmail-chestplate"]  = {1,1,10},
							["diamond-hoe"]           = {1,1,15},
							["diamond-chestplate"]    = {1,1,5},
							["enchanted-book-rnd"]    = {1,1,10},
						}
					},
					{
						rolls = {1,4},
						items = {
							["iron-ingot"]            = {1,4,10},
							["gold-ingot"]            = {1,4,5},
							["bread"]                 = {1,1,20},
							["wheat"]                 = {1,4,20},
							["bucket"]                = {1,1,10},
							["redstone"]              = {1,4,15},
							["coal"]                  = {1,4,15},
							["melon-seeds"]           = {2,4,10},
							["pumpkin-seeds"]         = {2,4,10},
							["beetroot-seeds"]        = {2,4,10},
						}
					},
					{
						rolls = {3,3},
						items = {
							["bone"]                  = {1,8,10},
							["gunpowder"]             = {1,8,10},
							["rotten-flesh"]          = {1,8,10},
							["string"]                = {1,8,10},
						}
					},
				},
				{
					{"bedrock"},
					{
						rolls = {1,3},
						items = {
							["lead"]                  = {1,1,100},
							["golden-apple"]          = {1,1,75},
							["enchanted-golden-apple"] = {1,1,10},
							["disc-13"]               = {1,1,75},
							["disc-cat"]              = {1,1,75},
							["name-tag"]              = {1,1,100},
							["chainmail-chestplate"]  = {1,1,50},
							["diamond-hoe"]           = {1,1,75},
							["diamond-chestplate"]    = {1,1,25},
							["enchanted-book-rnd"]    = {1,1,60},
						}
					},
					{
						rolls = {1,4},
						items = {
							["iron-ingot"]            = {1,4,50},
							["gold-ingot"]            = {1,4,25},
							["bread"]                 = {1,1,100},
							["wheat"]                 = {1,4,100},
							["bucket"]                = {1,1,50},
							["redstone"]              = {1,4,75},
							["coal"]                  = {1,4,75},
							["melon-seeds"]           = {2,4,50},
							["pumpkin-seeds"]         = {2,4,50},
							["beetroot-seeds"]        = {2,4,50},
						}
					},
					{
						rolls = {3,3},
						items = {
							["bone"]                  = {1,8,50},
							["gunpowder"]             = {1,8,50},
							["rotten-flesh"]          = {1,8,50},
							["string"]                = {1,8,50},
						}
					},
				},
			},
		},
		
	}
}

f = {

	-- this math is at the top simply for ease of inspection.
	
	calc_average_amount_this_item_per_pool = function( 
			min_stacksize, max_stacksize,
			min_pool_rolls, max_pool_rolls, 
			item_weight, pool_total_item_weight )

		local avg_stacksize = ( min_stacksize + max_stacksize ) / 2
		local avg_rolls = ( min_pool_rolls + max_pool_rolls ) / 2
		
		return avg_stacksize * avg_rolls * item_weight / pool_total_item_weight
		
	end,

	calc_chance_any_of_this_item_per_pool = function( 
			min_pool_rolls, max_pool_rolls,
			item_weight, pool_total_item_weight )

		local inverse_result = 0 -- 1 - inverse_result = return value
		local inverse_item_weight = pool_total_item_weight - item_weight
		
		-- will be used for the division in the for loop to avoid the slightly
		-- less performant math.pow(). The divisor already includes the probability
		-- of picking any specific number of rolls.
		local cur_dividend = inverse_item_weight
		local cur_divisor = pool_total_item_weight * (max_pool_rolls - min_pool_rolls + 1)
		
		for i = 1, max_pool_rolls do
			if i >= min_pool_rolls then
				inverse_result = inverse_result + cur_dividend / cur_divisor
			end
			cur_dividend = cur_dividend * inverse_item_weight -- simulate pow
			cur_divisor = cur_divisor * pool_total_item_weight -- simulate pow
		end
		
		return 1 - inverse_result
		
	end,
	
	get_item = function( item_key, item_display_name )
	
		local html = {}
		
		local item_title = item_display_name
		local item_link = item_display_name
		local item_id = item_key
		local sprite_type = d.items[item_key][1]
		local note_key = d.items[item_key].note
		local note_key_1 = d.items[item_key].note1
		
		if d.items[item_key].title ~= nil then
			item_title = d.items[item_key].title
		end
		if d.items[item_key].link ~= nil then
			item_link = d.items[item_key].link
		end
		if d.items[item_key].id ~= nil then
			item_id = d.items[item_key].id
		end
		
		if sprite_type == "item" or sprite_type == "block" then
			table.insert( html, p.current_frame:expandTemplate{ title = f.title_case(sprite_type) .. 'Link', args = { item_link , item_title , id = item_id, wrap = true } } )
		end
		
		if note_key ~= nil and d.notes[note_key] ~= nil then
			table.insert( html, p.current_frame:extensionTag( 'ref', d.notes[note_key], { group='note', name=note_key } ) )
		end
		
		if note_key_1 ~= nil and d.notes[note_key_1] ~= nil then
			if note_key == nil or d.notes[note_key] == nil or note_key ~= note_key_1 then
				table.insert( html, p.current_frame:extensionTag( 'ref', d.notes[note_key_1], { group='note', name=note_key_1 } ) )
			end
		end
		
		return table.concat( html )
		
	end,
	
	lpad = function(str, len, char)
	
		if char == nil then char = ' ' end
		return string.rep(char, len - #str) .. str
		
	end,

	find_chances_for_items = function( item_names )
	
		local chances = {}
		
		local all_editions = f.get_editions_hash()
		
		for chest_name, chest in pairs(d.chests) do
			
			for _, loot_table in pairs(chest.loot_tables or {}) do
				
				local editions, editions_upcoming = {}, {}
				
				for _, edition in pairs(loot_table[1]) do
					if edition:gsub( '-upcoming', '' ) == edition then
						editions[edition] = true
					else
						editions_upcoming[edition] = true
					end
				end
				
				for edition, _ in pairs(editions) do
					if editions_upcoming[edition] == nil then
						table.insert( loot_table[1], edition .. '-upcoming' )
					end
				end
				
				for _, item_name in pairs(item_names) do
					
					for pool_idx, pool in pairs(loot_table) do
						if pool_idx > 1 then
							
							local item_numbers = pool.items[item_name]
							if item_numbers ~= nil then
								
								local min_stacksize = item_numbers[1]
								local max_stacksize = item_numbers[2]
								local min_poolrolls = pool.rolls[1]
								local max_poolrolls = pool.rolls[2]
								
								local stack_size = min_stacksize
								if min_stacksize ~= max_stacksize then
									stack_size = min_stacksize .. "–" .. max_stacksize
								end
								
								local item_weight = item_numbers[3]
								
								local pool_total_item_weight = 0
								for item_name, item in pairs(pool.items) do
									pool_total_item_weight = pool_total_item_weight + item[3]
								end
							
								local chance = f.calc_chance_any_of_this_item_per_pool( 
									min_poolrolls, max_poolrolls,
									item_weight, pool_total_item_weight )
								
								local rolls = min_poolrolls
								if min_poolrolls ~= max_poolrolls then
									rolls = min_poolrolls .. "–" .. max_poolrolls
								end
								
								local num_items = string.format( "%.3f", f.calc_average_amount_this_item_per_pool(
									min_stacksize, max_stacksize,
									min_poolrolls, max_poolrolls,
									item_weight, pool_total_item_weight ) )
									
								local weight_frac = p.current_frame:expandTemplate{ title = 'frac', args = { item_weight, pool_total_item_weight } }
								
								local chance_per_chest = string.format( "%.1f", chance * 100 )
								local avg_num_chests = string.format( "%.1f", 1 / chance )
								
								local key = item_name .. '|' .. chest_name .. '|' .. stack_size .. '|' .. rolls .. '|' .. weight_frac .. '|' .. num_items .. '|' .. chance_per_chest .. '|' .. avg_num_chests
								
								if chances[key] == nil then
									chances[key] = {}
									chances[key].editions = {}
									chances[key].edition_variants = {}
									chances[key].unknown_editions = {}
								end
								
								for _, edition in pairs(loot_table[1]) do
									chances[key].editions[edition] = true
								end
							end
						end
					end
				end
			end
			
			-- check for edition variants,
			-- so instead of reporting table-cell "No", it reports "Variant".
			
			local variants = {}
			
			for _, item_name in pairs(item_names) do
				local item_chest = item_name .. '|' .. chest_name .. '|'
				variants[item_chest] = {}
				for key, _ in pairs(chances) do
					if key:sub(1, #item_chest) == item_chest then
						for edition, _ in pairs( chances[key].editions ) do
							variants[item_chest][edition] = true
						end
					end
				end
			end
		
			for key, chance in pairs(chances) do
				for item_chest, editions in pairs( variants ) do
					if key:sub(1, #item_chest) == item_chest then
						for edition, _ in pairs( editions ) do
							if chances[key].editions[edition] == nil then
								chances[key].edition_variants[edition] = true
							end
						end
						for edition, _ in pairs( all_editions ) do
							if chances[key].editions[edition] == nil
							and chances[key].edition_variants[edition] == nil then
								chances[key].unknown_editions[edition] = true
							end
						end
					end
				end
			end
			
		end
		
		-- add figure spaces for padding: each space is exactly the width of a digit.
		
		local numperchest_width_max = 0
		local chance_width_max = 0
		local numchests_width_max = 0
		
		local numperchest_width_min = 1000
		local chance_width_min = 1000
		local numchests_width_min = 1000
		
		for key, _ in pairs(chances) do
			for avg_num_per_chest, chance_per_chest, avg_num_chests in key:gmatch ".*|([%d%.]+)|([%d%.]+)|([%d%.]+)$" do
				
				numperchest_width_max = math.max( numperchest_width_max, string.len(avg_num_per_chest) )
				chance_width_max = math.max( chance_width_max, string.len(chance_per_chest) )
				numchests_width_max = math.max( numchests_width_max, string.len(avg_num_chests) )
				
				numperchest_width_min = math.min( numperchest_width_min, string.len(avg_num_per_chest) )
				chance_width_min = math.min( chance_width_min, string.len(chance_per_chest) )
				numchests_width_min = math.min( numchests_width_min, string.len(avg_num_chests) )
				
			end
		end
		
		local padded_chances = {}
		
		if chance_width_max ~= chance_width_min
		or numchests_width_max ~= numchests_width_min
		or numperchest_width_max ~= numperchest_width_min then
			
			for key, chance in pairs(chances) do
				for rest, avg_num_per_chest, chance_per_chest, avg_num_chests in key:gmatch "(.*)|([%d%.]+)|([%d%.]+)|([%d%.]+)$" do
					
					-- these spaces are "figure spaces", not normal spaces.
					key = rest .. '|' 
						.. f.lpad( avg_num_per_chest, numperchest_width_max, " " ) .. '|' 
						.. f.lpad( chance_per_chest, chance_width_max, " " ) .. '|' 
						.. f.lpad( avg_num_chests, numchests_width_max, " " )
						
					padded_chances[key] = chance
					
				end
			end
			
			chances = padded_chances
		
		end
		
		return chances
		
	end,
	
	-- this is so cell templates only get expanded once.
	
	upcoming_v_expanded = {},
	upcoming_expanded = {},
	until_expanded = {},
	yes_expanded = nil, 
	no_expanded = nil, 
	planned_expanded = nil, 
	unknown_expanded = nil,
	
	needs_testing_expanded = nil,
	
	warning_comment_expanded = nil,
	yes_comment_expanded = nil,
	info_comment_expanded = nil,
	
	upcoming_cell = function( edition )
		if f.upcoming_v_expanded[edition] == nil then
			f.upcoming_v_expanded[edition] = p.current_frame:expandTemplate{ title = 'v', args = { edition .. '-upcoming', link = 'none' } }
		end
		if f.upcoming_expanded[edition] == nil then
			f.upcoming_expanded[edition] = p.current_frame:expandTemplate{ title = 'Upcoming', args = { edition .. ' ' .. f.upcoming_v_expanded[edition] } }
		end
		return f.upcoming_expanded[edition]
	end,
	
	until_cell = function( edition )
		if f.upcoming_v_expanded[edition] == nil then
			f.upcoming_v_expanded[edition] = p.current_frame:expandTemplate{ title = 'v', args = { edition .. '-upcoming', link = 'none' } }
		end
		if f.until_expanded[edition] == nil then
			f.until_expanded[edition] = p.current_frame:expandTemplate{ title = 'Until', args = { edition .. ' ' .. f.upcoming_v_expanded[edition] } }
		end
		return f.until_expanded[edition]
	end,
	
	yes_cell = function()
		if f.yes_expanded == nil then
			f.yes_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Yes' } }
		end
		return f.yes_expanded
	end,
	
	no_cell = function()
		if f.no_expanded == nil then
			f.no_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'No' } }
		end
		return f.no_expanded
	end,
	
	planned_cell = function()
		if f.planned_expanded == nil then
			f.planned_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Planned', 'Yes' } }
		end
		return f.planned_expanded
	end,
	
	-- not currently used.
	unknown_cell = function()
		if f.needs_testing_expanded == nil then
			f.needs_testing_expanded = p.current_frame:expandTemplate{ title = 'needs testing', args = { 'This loot information has not been tested, in this edition.' } }
		end
		if f.unknown_expanded == nil then
			f.unknown_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Unknown' } } .. ' ' .. f.needs_testing_expanded
		end
		return f.unknown_expanded
	end,
	
	warning_comment = function()
		if f.warning_comment_expanded == nil then
			f.warning_comment_expanded = p.current_frame:expandTemplate{ title = 'Comment', args = { '!', '' } }
		end
		return f.warning_comment_expanded
	end,
	
	yes_comment = function()
		if f.yes_comment_expanded == nil then
			f.yes_comment_expanded = p.current_frame:expandTemplate{ title = 'Comment', args = { 'y', '' } }
		end
		return f.yes_comment_expanded
	end,
	
	info_comment = function()
		if f.info_comment_expanded == nil then
			f.info_comment_expanded = p.current_frame:expandTemplate{ title = 'Comment', args = { 'i', '' } }
		end
		return f.info_comment_expanded
	end,
	
	has_entries = function(_table)
		for _ in pairs(_table) do 
			return true
		end
		return false
	end,

	has_one_entry = function(_table)
		local first = false
		local second = false
		for _ in pairs(_table) do
			if first then
				second = true
			end
			first = true
			if first and second then
				return false
			end
		end
		return first and not second
	end,

	round = function(num, num_decimal_places)
	  local mult = 10^(num_decimal_places or 0)
	  return math.floor(num * mult + 0.5) / mult
	end,
	
	split = function (s, delimiter)
	    result = {};
	    for match in (s..delimiter):gmatch("(.-)"..delimiter) do
	        table.insert(result, match);
	    end
	    return result;
	end,
	
	title_case = function( str )
		local buf = {}
		for word in string.gfind(str, "%S+") do
			if word == "and" then
				table.insert( buf, word )
			else
				local first, rest = string.sub( word, 1, 1 ), string.sub( word, 2 )
				table.insert( buf, string.upper(first) .. string.lower(rest) )
			end
		end    
		return table.concat( buf, " " )
	end,
	
	capitalize = function( str )
		return ( string.lower(str):gsub( "^%l", string.upper ) )
	end,
	
	plural = function( item_name )
		
		if string.sub( item_name, -2 ) == 'ch'
			or string.sub( item_name, -2 ) == 'sh'
			or string.sub( item_name, -2 ) == 'zh'
			or string.sub( item_name, -1 ) == 's'
			or string.sub( item_name, -1 ) == 'x'
			or string.sub( item_name, -1 ) == 'z' then
			
			return item_name .. 'es'
			
		end
		
		if string.sub( item_name, -1 ) == 'y' then
			
			if string.sub( item_name, -2 ) == 'ay'
				or string.sub( item_name, -2 ) == 'ey'
				or string.sub( item_name, -2 ) == 'oy'
				or string.sub( item_name, -2 ) == 'uy' then
				
				return item_name .. 's'
				
			end
			
			return string.sub( item_name, 1, -2 ) .. 'ies'
			
		end
		
		if string.sub( item_name, -1 ) == 'f' then
			
			if string.sub( item_name, -2 ) == 'ff' then
				
				return item_name .. 's'
				
			end
			
			return string.sub( item_name, 1, -2 ) .. 'ves'
			
		end
		
		if string.sub( item_name, -2 ) == 'fe' then
			
			return string.sub( item_name, 1, -3 ) .. 'ves'
			
		end
		
		return item_name .. 's'
		
	end,
	
	discover_item_properties = function( item_key )
		
		local item = d.items[item_key];
		
		if item.material == nil then
			
			item.material = 0
			if string.find( item_key, "leather-" ) ~= nil then item.material = 1 end
			if string.find( item_key, "iron-" ) ~= nil then item.material = 2 end
			if string.find( item_key, "golden-" ) ~= nil then item.material = 3 end
			if string.find( item_key, "chainmail-" ) ~= nil then item.material = 4 end
			if string.find( item_key, "diamond-" ) ~= nil then item.material = 5 end
			if string.find( item_key, "netherite-" ) ~= nil then item.material = 6 end
			
		end
		
		if item.armor == nil then
			
			item.armor = 0
			if string.find( item_key, "-helmet" ) ~= nil or string.find( item_key, "-cap" ) ~= nil then item.armor = 1 end
			if string.find( item_key, "-chestplate" ) ~= nil or string.find( item_key, "-tunic" ) ~= nil then item.armor = 2 end
			if string.find( item_key, "-leggings" ) ~= nil or string.find( item_key, "-pants" ) ~= nil then item.armor = 3 end
			if string.find( item_key, "-boots" ) ~= nil then item.armor = 4 end
			
		end
		
	end,
	
	sort_item_table = function( a, b )
		
		local item_key_a, chest_key_a, _, _, _, num_items_a, chance_a = unpack( f.split( a.pipe_separated_details, '|' ) )
		local item_key_b, chest_key_b, _, _, _, num_items_b, chance_b = unpack( f.split( b.pipe_separated_details, '|' ) )
		
		f.discover_item_properties(item_key_a)
		f.discover_item_properties(item_key_b)
		
		-- material first, in tier order
		if d.items[item_key_a].material ~= d.items[item_key_b].material then return ( d.items[item_key_a].material < d.items[item_key_b].material ) end
		
		-- armor goes in head-to-toe order
		if d.items[item_key_a].armor ~= d.items[item_key_b].armor then return ( d.items[item_key_a].armor < d.items[item_key_b].armor ) end
		
		-- after that, item name, alphabetically
		if item_key_a ~= item_key_b then return ( item_key_a < item_key_b ) end
		
		-- container's structure's name, alphabetically
		if d.chests[chest_key_a].item_table_display.structure_text ~= d.chests[chest_key_b].item_table_display.structure_text then
			return ( d.chests[chest_key_a].item_table_display.structure_text < d.chests[chest_key_b].item_table_display.structure_text )
		end
		
		-- "bastion-other" comes last among containers
		-- it's a little awkward having "other" float in the middle of the list.
		if ( chest_key_a == 'bastion-other' ) ~= ( chest_key_b == 'bastion-other' ) then return ( chest_key_b == 'bastion-other' ) end
		
		-- container name, alphabetically
		if ( d.chests[chest_key_a].item_table_display.container or 'Chest' ) ~= ( d.chests[chest_key_b].item_table_display.container or 'Chest' ) then
			return ( ( d.chests[chest_key_a].item_table_display.container or 'Chest' ) < ( d.chests[chest_key_b].item_table_display.container or 'Chest' ) )
		end
		
		-- if num_items_a ~= num_items_b then return ( num_items_a < num_items_b ) end
		
		-- if chance_a ~= chance_b then return ( chance_a < chance_b ) end
		
		-- a[2]
		
		return a.pipe_separated_details < b.pipe_separated_details
		
	end,
	
	item_lookahead_fn = function( item_key, item_key_lookahead )
		return item_key == item_key_lookahead
	end,
	
	structure_lookahead_fn = function( item_key, item_key_lookahead, chest_key, chest_key_lookahead )
		return item_key == item_key_lookahead
			and d.chests[chest_key].item_table_display.structure_id == d.chests[chest_key_lookahead].item_table_display.structure_id
	end,
	
	container_lookahead_fn = function( item_key, item_key_lookahead, chest_key, chest_key_lookahead )
		return item_key == item_key_lookahead
			and d.chests[chest_key].item_table_display.structure_id == d.chests[chest_key_lookahead].item_table_display.structure_id
			and chest_key == chest_key_lookahead
	end,
	
	find_rowspan = function( chances_list, ch_idx, item_key, chest_key, lookahead_fn )
	
		local span = 0
		
		for ch_idx_lookahead = ch_idx, #chances_list do
			
			local item_key_lookahead, chest_key_lookahead = unpack( f.split( chances_list[ch_idx_lookahead].pipe_separated_details, '|' ) )
			
			if lookahead_fn( item_key, item_key_lookahead, chest_key, chest_key_lookahead ) then
				span = span + 1
			else
				break
			end
		end
		
		return span
		
	end,
	
	get_availability = function( edition, edition_lists )
	
		local availability
	
		if edition_lists.available[edition] ~= nil and edition_lists.available[edition .. '-upcoming'] == nil then
			return f.availability.UNTIL
		elseif edition_lists.available[edition] == nil and edition_lists.available[edition .. '-upcoming'] ~= nil then
			return f.availability.UPCOMING
		elseif edition_lists.available[edition] ~= nil and edition_lists.available[edition .. '-upcoming'] ~= nil then
			return f.availability.YES
		elseif edition_lists.variants[edition] ~= nil or edition_lists.variants[edition .. '-upcoming'] ~= nil then
			return f.availability.VARIANT
		elseif edition_lists.unknown[edition] ~= nil then
			return f.availability.UNKNOWN
		else
			return f.availability.NO
		end
		
	end,
	
	cell_for = function( edition, availability )
		
		local switch = {
			[f.availability.UNTIL]    = f.planned_cell() .. ' ' .. f.until_cell( edition ),
			[f.availability.UPCOMING] = f.planned_cell() .. ' ' .. f.upcoming_cell( edition ),
			[f.availability.YES]      = f.yes_cell(),
			[f.availability.VARIANT]  = '<abbr style="color: gray;" title="In this edition, this item in this chest has different chances.">Variant</abbr>',
			[f.availability.NO]       = f.no_cell(),
			[f.availability.UNKNOWN]  = '<abbr style="color: gray;" title="No data yet for this edition.">?</abbr>',
		}
		
		return switch[availability]
		
	end,
	
	availability = {
		UNKNOWN = 0,
		YES = 1,
		NO = 2,
		UNTIL = 3,
		UPCOMING = 4,
		VARIANT = 5,
	},
	
	get_editions_hash = function()
	
		local editions_hash = {}
		
		for chest_key, _ in pairs( d.chests ) do
			for _, loot_table in pairs( d.chests[chest_key].loot_tables ) do
				for _, edition in pairs( loot_table[1] ) do
					if edition:gsub( '-upcoming', '' ) == edition then
						editions_hash[edition] = true
					end
				end
			end
		end
		
		return editions_hash
		
	end,
	
	get_editions = function()
	
		local editions = {}
		
		for edition, _ in pairs( f.get_editions_hash() ) do
			table.insert( editions, edition )
		end
		
		table.sort( 
			editions,
			function( a, b )
				return ( d.edition_headers[a] or f.capitalize(a) )
				< ( d.edition_headers[b] or f.capitalize(b) )
			end )
		
		return editions
		
	end
}

p = {

	audit = function()
	
		p.current_frame = mw.getCurrentFrame()

		local html = {}
		
		-- 
		
		local deficiencies = {}
		for item_key, _ in pairs( d.items ) do
			
			local item_found = false
			
			for chest_key, _ in pairs( d.chests ) do
				for _, loot_table in pairs( d.chests[chest_key].loot_tables ) do
					for pool_idx, pool in pairs( loot_table ) do
						if pool_idx > 1 then
							for item_in_chest, _ in pairs( pool.items ) do
								if item_in_chest == item_key then
									item_found = true
									break
								end
							end
						end
						if item_found then
							break
						end
					end
					if item_found then
						break
					end
				end
				if item_found then
					break
				end
			end
			
			if not item_found then
				table.insert( deficiencies, '* ' .. item_key .. '\n' )
			end
		end
		
		if #deficiencies == 0 then
			table.insert( html, f.yes_comment() )
		else
			table.insert( html, f.warning_comment() )
		end
		
		table.insert( html, ' d.items that aren\'t in any d.chests:\n' )
		
		if #deficiencies == 0 then
			table.insert( html, '* \'\'none\'\'\n' )
		else
			for _, deficiency in pairs(deficiencies) do
				table.insert( html, deficiency )
			end
		end
		
		-- 
		
		deficiencies = {}
		for note_key, _ in pairs( d.notes ) do
			
			local note_found = false
			
			for item_key, item_def in pairs( d.items ) do
				if ( item_def.note ~= nil and item_def.note == note_key )
				or ( item_def.note1 ~= nil and item_def.note1 == note_key ) then
					note_found = true
					break
				end
			end
			
			if not note_found then
				table.insert( deficiencies, '* ' .. note_key .. '\n' )
			end
		end
		
		if #deficiencies == 0 then
			table.insert( html, f.yes_comment() )
		else
			table.insert( html, f.warning_comment() )
		end
		
		table.insert( html, ' d.notes that aren\'t on any d.items:\n' )
		
		if #deficiencies == 0 then
			table.insert( html, '* \'\'none\'\'\n' )
		else
			for _, deficiency in pairs(deficiencies) do
				table.insert( html, deficiency )
			end
		end
		
		-- 
		
		deficiencies = {}
		for chest_key, _ in pairs( d.chests ) do
			for _, loot_table in pairs( d.chests[chest_key].loot_tables ) do
				for pool_idx, pool in pairs( loot_table ) do
					if pool_idx > 1 then
						for item_in_chest, _ in pairs( pool.items ) do
							if d.items[item_in_chest] == nil then
								table.insert( deficiencies, '* ' .. chest_key .. ' -> ' .. item_in_chest .. '\n' )
							end
						end
					end
				end
			end
		end
		
		if #deficiencies == 0 then
			table.insert( html, f.yes_comment() )
		else
			table.insert( html, f.warning_comment() )
		end
		
		table.insert( html, ' d.chests containing items that aren\'t in d.items:\n' )
		
		if #deficiencies == 0 then
			table.insert( html, '* \'\'none\'\'\n' )
		else
			for _, deficiency in pairs(deficiencies) do
				table.insert( html, deficiency )
			end
		end
		
		-- 
		
		deficiencies = {}
		for item_key, item_def in pairs( d.items ) do
			if item_def.note ~= nil and d.notes[item_def.note] == nil then
				table.insert( deficiencies, '* ' .. item_key .. ' -> ' .. item_def.note .. '\n' )
			end
			if item_def.note1 ~= nil and d.notes[item_def.note1] == nil then
				table.insert( deficiencies, '* ' .. item_key .. ' -> ' .. item_def.note1 .. '\n' )
			end
		end
		
		if #deficiencies == 0 then
			table.insert( html, f.yes_comment() )
		else
			table.insert( html, f.warning_comment() )
		end
		
		table.insert( html, ' d.items containing notes that aren\'t in d.notes:\n' )
		
		if #deficiencies == 0 then
			table.insert( html, '* \'\'none\'\'\n' )
		else
			for _, deficiency in pairs(deficiencies) do
				table.insert( html, deficiency )
			end
		end
		
		-- 
		
		table.insert( html, f.info_comment() )
		
		table.insert( html, ' editions:\n' )
		
		local editions = f.get_editions()
		
		if #editions == 0 then
			table.insert( html, '* \'\'none\'\'\n' )
		else
			for _, edition in pairs( editions ) do
				table.insert( html, '* ' .. edition .. '\n' )
			end
		end
		
		-- 
		
		return table.concat( html )
	
	end,

	make_item_table = function( ... )

		p.current_frame = mw.getCurrentFrame()

		local args = { ... }
		if args[1] == p.current_frame then 
			args = require( 'Module:ProcessArgs' ).merge( true )
		else
			args = args[1]
		end
		
		local error_msg = ""
		
		local item_names = {}
		if args[1] == "ALL" then
			for item_name, v in pairs( d.items ) do
				table.insert( item_names, item_name )
			end
		else
			item_names = mw.text.split( args[1]:gsub( '%s+', '' ), ',' )
		end
		
		-- error message for unknown items,
		-- and restrict it to a distinct set of items
		
		local available_item_names = {}
		local distinct_item_names = {}
		
		for x, item_name in pairs( item_names ) do
			if distinct_item_names[item_name] == nil then
				if d.items[item_name] == nil then
					error_msg = error_msg .. "<span class='error'>Unknown item '" .. item_name .. "'.</span><br>\n"
				else
					table.insert( available_item_names, item_name )
				end
				distinct_item_names[item_name] = true
			end
		end
		
		item_names = available_item_names
		
		local single_item = f.has_one_entry( item_names )
		
		-- calculate the chances, change from associative to plain array, sort
		
		local chance_info = f.find_chances_for_items( item_names )
		
		local chances_list = {}
		for pipe_separated_details, ed in pairs( chance_info ) do
			table.insert( chances_list, 
				{
					pipe_separated_details = pipe_separated_details, 
					edition_lists = { 
						available = ed.editions, 
						variants = ed.edition_variants, 
						unknown = ed.unknown_editions 
					}
				}
			)
		end
		
		table.sort( chances_list, f.sort_item_table )
		
		-- build the html
		
		local html = {}
		
		table.insert( html, error_msg )
		
		if f.has_entries( chances_list ) then
			
			if single_item then
					
				local item_display_name, item_key

				item_key = item_names[1]
				
				if d.items[item_key].plural ~= nil and d.items[item_key].plural ~= false then
					item_display_name = d.items[item_key].plural
				else
					if d.items[item_key].title ~= nil then
						item_display_name = f.capitalize( d.items[item_key].title )
					else
						item_display_name = f.capitalize( string.gsub( item_key, '-', ' ' ) )
					end				
					if d.items[item_key].plural == nil or d.items[item_key].plural ~= false then
						item_display_name = f.plural( item_display_name )
					end
				end
				
				table.insert( html, item_display_name .. ' may be found in the following chests, with the following distribution: \n' )
				
			end
			
			table.insert( html, '{| class="wikitable sortable" \n' )
			
			if not single_item then
				table.insert( html, '! Item \n' )
			end
			
			table.insert( html, '! Structure \n' )
			table.insert( html, '! Container \n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['stacksize'] )
			table.insert( html, '"> Stack Size </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{
				name = "ref", content = d.column_hovertext['stacksize'], args = { name = 'stacksize', group = 'FN' }
			} )
			table.insert( html, '</span>\n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['rolls'] )
			table.insert( html, '"> Rolls </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{
				name = "ref", content = d.column_hovertext['rolls'], args = { name = 'rolls', group = 'FN' }
			} )
			table.insert( html, '</span>\n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['weight'] )
			table.insert( html, '"> Weight </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{ 
				name = "ref", content = d.column_hovertext['weight'], args = { name = 'weight', group = 'FN' } 
			} )
			table.insert( html, '</span>\n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['chance'] )
			table.insert( html, '"> Chance </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{ 
				name = "ref", content = d.column_hovertext['chance'], args = { name = 'chance', group = 'FN' } 
			} )
			table.insert( html, '</span>\n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['items'] )
			table.insert( html, '"> Avg. # items<br>per chest </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{ 
				name = "ref", content = d.column_hovertext['items'], args = { name = 'items', group = 'FN' } 
			} )
			table.insert( html, '</span>\n' )
			
			table.insert( html, '! <abbr title="' )
			table.insert( html, d.column_hovertext['chests'] )
			table.insert( html, '"> Avg # chests<br>to search </abbr> <span class=mobileonly>' )
			table.insert( html, p.current_frame:extensionTag{ 
				name = "ref", content = d.column_hovertext['chests'], args = { name = 'chests', group = 'FN' } 
			} )
			table.insert( html, '</span>\n' )
			
			for _, edition_name in pairs( f.get_editions() ) do
				table.insert( html, '! ' .. ( d.edition_headers[edition_name] or f.capitalize(edition_name) ) .. ' \n' )
			end
			
		end
		
		local item_span = 1
		local structure_span = 1
		local container_span = 1
		
		local item_expanded = {}
		local chest_expanded = {}
		
		for ch_idx, chances in pairs( chances_list ) do
			
			local item_key, chest_key, stack_size, rolls, weight, num_items, chance, num_chests = unpack( f.split( chances.pipe_separated_details, '|' ) )
			
			item_span = item_span - 1
			local do_item_row = false
			if item_span == 0 then
				item_span = f.find_rowspan( chances_list, ch_idx, item_key, chest_key, f.item_lookahead_fn )
				do_item_row = true
			end
			
			structure_span = structure_span - 1
			local do_structure_row = false			
			if structure_span == 0 then
				structure_span = f.find_rowspan( chances_list, ch_idx, item_key, chest_key, f.structure_lookahead_fn )
				do_structure_row = true
			end
			
			container_span = container_span - 1
			local do_container_row = false			
			if container_span == 0 then
				container_span = f.find_rowspan( chances_list, ch_idx, item_key, chest_key, f.container_lookahead_fn )
				do_container_row = true
			end
			
			local item_display_name
			
			if d.items[item_key].title ~= nil then
				item_display_name = d.items[item_key].title
			else
				item_display_name = f.title_case( string.gsub( item_key, '-', ' ' ) )
			end
			
			if not single_item and item_expanded[item_key] == nil then
				item_expanded[item_key] = f.get_item( item_key, item_display_name )
			end
			
			local item_table_display = d.chests[chest_key].item_table_display
			
			if chest_expanded[chest_key] == nil then
				chest_expanded[chest_key] = p.current_frame:expandTemplate{ title = 'EnvLink', args = { item_table_display.structure_text, id = item_table_display.structure_id, wrap = true } }
			end
			
			table.insert( html, '|-\n' )
			if not single_item then
				if do_item_row then
					if item_span > 1 then
						table.insert( html, "|rowspan=" .. item_span )
					end
					table.insert( html, "|" .. item_expanded[item_key] .. "\n" )
				end
			end

			if do_structure_row then
				if structure_span > 1 then
					table.insert( html, "|rowspan=" .. structure_span )
				end
				table.insert( html, "|" .. chest_expanded[chest_key] .. '\n' )
			end

			if do_container_row then
				if container_span > 1 then
					table.insert( html, "|rowspan=" .. container_span )
				end
				table.insert( html, "|" .. ( item_table_display.container or 'Chest' ) .. '\n' )
			end

			table.insert( html, "|style='text-align:center;'|" .. stack_size .. '\n' )
			table.insert( html, "|style='text-align:center;'|" .. rolls .. '\n' )
			table.insert( html, "|style='text-align:center;'|" .. weight .. '\n' )
			table.insert( html, "|style='text-align:center;'|" .. chance .. '%\n' )
			table.insert( html, "|style='text-align:center;'|" .. num_items .. '\n' )
			table.insert( html, "|style='text-align:center;'|" .. num_chests .. '\n' )
			for _, edition_name in pairs( f.get_editions() ) do
				local availability = f.get_availability( edition_name, chances.edition_lists )
				table.insert( html, '|' .. f.cell_for( edition_name, availability ) .. '\n' )
			end
			
		end
		
		if f.has_entries( chances_list ) then

			table.insert( html, '|}' )

			table.insert( html, '<div class=mobileonly>' )
			table.insert( html, p.current_frame:expandTemplate{ title = 'FNlist', args = {} } )
			table.insert( html, '</div>' )

			table.insert( html, p.current_frame:extensionTag( 'references', "", { group="note" } ) )
			table.insert( html, '\n' )

		end
		
		return table.concat( html )
		
	end,
	
	make_chest_table = function( ... )
	
	end
}

return p