Module:LootChest2

local p = {

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, ['java'] = 'In Java Edition, ', ['java-upcoming'] = 'In, ', ['bedrock'] = 'In Bedrock Edition, ', ['bedrock-upcoming'] = 'In ', ['java-upcoming-version'] = '', ['bedrock-upcoming-version'] = '', -- These 'items' define which sprite, label and link to use in the table. -- Order within this 'items' list doesn't matter. items = { ["acacia-log"]         = { "block", link="Log" }, ["acacia-sapling"]     = { "block", link="Sapling" }, ["activator-rail"]     = { "block" }, ["ancient-debris"]     = { "block" }, ["apple"]              = { "item" }, ["arrow"]              = { "item" }, ["bamboo"]             = { "item" }, ["barrel"]             = { "block" }, ["beetroot"]           = { "item" }, ["beetroot-seeds"]     = { "item" }, ["beetroot-soup"]		= { "item" }, ["bell"]				= { "block" }, ["birch-log"]          = { "block", link="Log" }, ["birch-sapling"]      = { "block", link="Sapling" }, ["black-wool"]         = { "block", link="Wool" }, ["block-of-gold"]      = { "block" }, ["blue-ice"]			= { "block" }, ["bone"]               = { "item" }, ["bone-block"]         = { "block" }, ["book"]               = { "item" }, ["book-and-quill"]     = { "item", title="Book and Quill" }, ["bottle-o'-enchanting"] = { "item", title="Bottle o' Enchanting" }, ["bread"]              = { "item" }, ["brown-mushroom"]     = { "block", link="Mushroom" }, ["brown-wool"]         = { "block", link="Wool" }, ["bucket"]             = { "item" }, ["buried-treasure-map"] = { "item", link="Explorer Map" }, ["cactus"]             = { "block" }, ["cake"]               = { "block" }, ["carrot"]             = { "item" }, ["chain"]              = { "block" }, ["chainmail-boots"]    = { "item", link="Armor" }, ["chainmail-chestplate"] = { "item", link="Armor" }, ["chainmail-helmet"]   = { "item", link="Armor" }, ["chainmail-leggings"] = { "item", link="Armor" }, ["clay"]				= { "item", link="Clay (ball)" }, ["clock"]				= { "item" }, ["coal"]               = { "item" }, ["cocoa-beans"]        = { "item" }, ["cooked-cod"]         = { "item"}, ["cooked-porkchop"]		= { "item" }, ["cooked-salmon"]      = { "item"}, ["compass"]            = { "item" }, ["crimson-fungus"]		= { "block", link="Fungus" }, ["crimson-nylium"]		= { "block", link="Nylium"}, ["crimson-roots"]		= { "block", link="Roots"}, ["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" }, ["disc-13"]            = { "item", id='music-disc-13', title="Music Disc (13)", link="Music Disc" }, ["disc-cat"]           = { "item", id='music-disc-cat',title="Music Disc (Cat)", link="Music Disc" }, ["disc-mellohi"]       = { "item", id='music-disc-mellohi',title="Music Disc (Mellohi)", link="Music Disc" }, ["disc-pigstep"]		= { "item", id='music-disc-pigstep', title = "Music Disc (Pigstep)", link="Music Disc" }, ["disc-wait"]          = { "item", id='music-disc-wait',title="Music Disc (Wait)", link="Music Disc" }, ["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-treasure"] = { "item", id='enchanted-book', title="Enchanted Book", link="Enchanted Book", note="enchant-randomly-treasure" }, ["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" }, ["flint-and-steel"]    = { "item" }, ["flower-pot"]			= { "item" }, ["furnace"]            = { "block" }, ["gilded-blackstone"]	= { "block" }, ["glistering-melon-slice"] = { "item" }, ["glowstone"]			= { "block" }, ["golden-apple"]       = { "item" }, ["golden-boots"]		= { "item", link="Armor" }, ["golden-carrot"]		= { "item" }, ["golden-chestplate"]  = { "item", link="Armor" }, ["golden-helmet"]      = { "item", link="Armor" }, ["golden-horse-armor"] = { "item", link="Horse Armor" }, ["golden-leggings"]		= { "item", link="Armor" }, ["golden-sword"]       = { "item", link="Sword" }, ["gold-ingot"]         = { "item" }, ["gold-nugget"]        = { "item" }, ["grass"]				= { "block", link="Grass" }, ["gray-wool"]          = { "block", link="Wool" }, ["green-dye"]			= { "item", link="Dye" }, ["gunpowder"]          = { "item" }, ["heart-of-the-sea"]   = { "item", link="Heart of the Sea" }, ["ink-sac"]            = { "item" }, ["iron-boots"]         = { "item", link="Armor" }, ["iron-chestplate"]    = { "item", link="Armor" }, ["iron-helmet"]        = { "item", link="Armor" }, ["iron-horse-armor"]   = { "item", link="Horse Armor" }, ["iron-ingot"]         = { "item" }, ["iron-leggings"]      = { "item", link="Armor" }, ["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" }, ["large-fern"]			= { "block", link="Grass" }, ["lead"]               = { "item" }, ["leather"]     		= { "item" }, ["leather-boots"]      = { "item", link="Armor" }, ["leather-cap"]        = { "item", link="Armor" }, ["leather-pants"]      = { "item", link="Armor" }, ["leather-tunic"]      = { "item", link="Armor" }, ["light-gray-wool"]    = { "block", link="Wool" }, ["light-weighted-pressure-plate"] = { "block", link="Pressure Plate" }, ["lodestone"]			= { "block" }, ["melon-seeds"]        = { "item" }, ["magma-cream"]        = { "item" }, ["name-tag"]           = { "item" }, ["netherite-boots"]    = { "item", link="Armor" }, ["netherite-chestplate"] = { "item", link="Armor" }, ["netherite-helmet"]   = { "item", link="Armor" }, ["netherite-ingot"]    = { "item" }, ["netherite-leggings"] = { "item", link="Armor" }, ["netherite-scrap"]    = { "item" }, ["nether-wart"]        = { "item" }, ["nether-quartz"]		= { "item" }, ["oak-log"]            = { "block", link="Log" }, ["oak-planks"]         = { "block", link="Planks", id="oak-wood-planks" }, ["oak-sapling"]        = { "block", link="Sapling" }, ["oak-sign"]           = { "item", link="Sign" }, ["obsidian"]           = { "block" }, ["paper"]              = { "item" }, ["piglin-banner-pattern"] = { "item", id="banner-pattern", link="Banner Pattern" }, ["poisonous-potato"]   = { "item" }, ["poppy"]				= { "block", link="Flower" }, ["potato"]             = { "item" }, ["potion-of-regeneration"] = { "item", link="Potion", title="Potion of Regeneration" }, ["potion-of-water-breathing"] = { "item", link="Potion", title="Potion of Water Breathing" }, ["powered-rail"]       = { "block", title="Powered Rails" }, ["prismarine-crystals"] = { "item" }, ["pumpkin"]            = { "block" }, ["pumpkin-pie"]        = { "item" }, ["pumpkin-seeds"]      = { "item" }, ["rail"]               = { "block", title="Rails" }, ["raw-beef"]		   = { "item", link="Raw Beef" }, ["raw-cod"]            = { "item", link="Raw Cod" }, ["raw-mutton"]			= { "item", link="Raw Mutton" }, ["raw-porkchop"]		= { "item", link="Raw Porkchop" }, ["raw-salmon"]         = { "item", link="Raw Salmon" }, ["redstone"]           = { "item", id="redstone-dust", title="Redstone Dust" }, ["rotten-flesh"]       = { "item" }, ["saddle"]             = { "item" }, ["sand"]               = { "block" }, ["shears"]             = { "item" }, ["smooth-stone"]		= { "block" }, ["snowball"]			= { "item", link="Snowball" }, ["snow-block"]			= { "block", link="Snow Block" }, ["soul-sand"]			= { "block" }, ["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" }, ["stone-axe"]          = { "item", link="Axe" }, ["stone-bricks"]       = { "block" }, ["stone-pickaxe"]      = { "item", link="Pickaxe" }, ["string"]             = { "item" }, ["suspicious-stew"]    = { "item", note="suspicious-stew" }, ["sweet-berries"]      = { "item" }, ["tall-grass"]			= { "block", link="Grass" }, ["tnt"]                = { "block", title="TNT" }, ["torch"]              = { "block" }, ["tripwire-hook"]      = { "block" }, ["water-bucket"]       = { "item" }, ["wheat"]              = { "item" }, ["wheat-seeds"]        = { "item" }, ["white-wool"]         = { "block", link="Wool" }, ["wooden-axe"]         = { "item", link="Axe" }, ["wooden-hoe"]         = { "item", link="Hoe" }, ["wooden-pickaxe"]     = { "item", link="Pickaxe" }, ["yellow-dye"]			= { "item", link="Dye" }, ["map"]                = { "item", link="Map", note="map" },

["damaged-netherite-boots"]				= { "item", id="netherite-boots", link="Armor", note="damaged-0.2-0.65"}, ["random-enchanted-damaged-netherite-boots"] = { "item", id="netherite-boots", title="Randomly enchanted damaged netherite boots", link="Armor", note="enchant-randomly", note1="damaged-0.2-0.65" }, ["damaged-netherite-chestplate"]		= { "item", id="netherite-chestplate", link="Armor", note="damaged-0.2-0.65"}, ["random-enchanted-damaged-netherite-chestplate"] = { "item", id="netherite-chestplate", title="Randomly enchanted damaged netherite chestplate", link="Armor", note="enchant-randomly", note="damaged-0.2-0.65" }, ["damaged-netherite-helmet"]			= { "item", id="netherite-helmet", link="Armor", note="damaged-0.2-0.65"}, ["random-enchanted-damaged-netherite-helmet"] = { "item", id="netherite-helmet", title="Randomly enchanted damaged netherite helmet", link="Armor", note="enchant-randomly", note="damaged-0.2-0.65" }, ["enchanted-netherite-hoe"]				= { "item", id="netherite-hoe", link="Hoe", note="enchant-with-levels-20-39" }, ["damaged-netherite-leggings"]			= { "item", id="netherite-leggings", link="Armor", note="damaged-0.2-0.65"}, ["random-enchanted-damaged-netherite-leggings"]	= { "item", id="netherite-leggings", title="Randomly enchanted damaged netherite leggings", link="Armor", note="enchant-randomly", note="damaged-0.2-0.65" }, ["random-enchanted-netherite-shovel"]	= { "item", id="netherite-shovel", title="Randomly enchanted netherite shovel", link="Shovel", note="enchant-randomly"}, ["damaged-netherite-sword"]				= { "item", id="netherite-sword", link="Sword", note="damaged-0.2-0.65"}, ["random-enchanted-damaged-netherite-shovel"] = { "item", id="netherite-shovel", title="Randomly enchanted damaged netherite shovel", link="Shovel", note="enchant-randomly", note="damaged-0.15-0.45"}, ["random-enchanted-damaged-netherite-sword"] = { "item", id="netherite-sword", title="Randomly enchanted damaged netherite sword", link="Sword", note="enchant-randomly", note="damaged-0.2-0.65" }, ["enchanted-diamond-boots"]				= { "item", id="diamond-boots", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-diamond-chestplate"]		= { "item", id="diamond-chestplate", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-diamond-helmet"]			= { "item", id="diamond-helmet", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-diamond-leggings"]			= { "item", id="diamond-leggings", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-diamond-pickaxe"]			= { "item", id="diamond-pickaxe", link="Pickaxe", note="enchant-with-levels-20-39" }, ["enchanted-diamond-shovel"]			= { "item", id="diamond-shovel", link="Shovel", note="enchant-with-levels-20-39" }, ["enchanted-diamond-sword"]				= { "item", id="diamond-sword", link="Sword", note="enchant-with-levels-20-39" }, ["enchanted-iron-boots"]				= { "item", id="iron-boots", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-iron-chestplate"]			= { "item", id="iron-chestplate", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-iron-helmet"]				= { "item", id="iron-helmet", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-iron-leggings"]				= { "item", id="iron-leggings", link="Armor", note="enchant-with-levels-20-39" }, ["enchanted-iron-pickaxe"]				= { "item", id="iron-pickaxe", link="Pickaxe", note="enchant-with-levels-20-39" }, ["enchanted-iron-shovel"]				= { "item", id="iron-shovel", link="Shovel", note="enchant-with-levels-20-39" }, ["enchanted-iron-sword"]				= { "item", id="iron-sword", link="Sword", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-axe"]			= { "item", id="golden-axe", title="Randomly enchanted golden axe", link="Axe", note="enchant-randomly" }, ["enchanted-golden-boots"]     		= { "item", id="golden-boots", link="Armor", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-boots"]		= { "item", id="golden-boots", title="Randomly enchanted golden boots", link="Armor", note="enchant-randomly" }, ["enchanted-golden-boots-soul-speed"]  = { "item", id="golden-boots", title="Golden boots enchanted with Soul Speed", link="Armor", note="enchant-randomly-soul-speed" }, ["enchanted-golden-chestplate"]			= { "item", id="golden-chestplate", link="Armor", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-chestplate"]	= { "item", id="golden-chestplate", title="Randomly enchanted golden chestplate", link="Armor", note="enchant-randomly" }, ["enchanted-golden-helmet"]				= { "item", id="golden-helmet", link="Armor", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-helmet"]		= { "item", id="golden-helmet", title="Randomly enchanted golden helmet", link="Armor", note="enchant-randomly" }, ["enchanted-golden-hoe"]				= { "item", id="golden-hoe", link="Hoe", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-hoe"]			= { "item", id="golden-hoe", title="Randomly enchanted golden hoe", link="Hoe", note="enchant-randomly" }, ["enchanted-golden-leggings"]			= { "item", id="golden-leggings", link="Armor", note="enchant-with-levels-20-39" }, ["random-enchanted-golden-leggings"]	= { "item", id="golden-leggings", title="Randomly enchanted golden leggings", link="Armor", note="enchant-randomly" }, ["random-enchanted-golden-pickaxe"]		= { "item", id="golden-pickaxe", title="Randomly enchanted golden pickaxe", link="Pickaxe", note="enchant-randomly" }, ["random-enchanted-golden-shovel"]		= { "item", id="golden-shovel", title="Randomly enchanted golden shovel", link="Shovel", note="enchant-randomly" }, ["random-enchanted-golden-sword"]		= { "item", id="golden-sword", title="Randomly enchanted golden sword", link="Sword", note="enchant-randomly" }, ["random-enchanted-leather-boots"]		= { "item", id="leather-boots", title="Randomly enchanted leather boots", link="Armor", note="enchant-randomly" }, ["random-enchanted-leather-cap"]		= { "item", id="leather-cap", title="Randomly enchanted leather cap", link="Armor", note="enchant-randomly" }, ["random-enchanted-leather-pants"]		= { "item", id="leather-pants", title="Randomly enchanted leather pants", link="Armor", note="enchant-randomly" }, ["random-enchanted-leather-tunic"]		= { "item", id="leather-tunic", title="Randomly enchanted leather tunic", link="Armor", note="enchant-randomly" }, ["random-enchanted-damaged-crossbow"]	= { "item", id="crossbow", title="Randomly enchanted damaged crossbow", link="Crossbow", note="enchant-randomly", note="damaged-0.1-0.5" },

["empty"]                       = { "block", id="air", link='', title='Nothing', note="nothing" }, },

notes = { ["damaged-0.1-0.5"] = "The item will only have between 10% and 50% of its total durability.", ["damaged-0.15-0.45"] = "The item will only have between 15% and 45% 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, except treasure enchantments, and any level of the enchantment is equally probable.", ["enchant-randomly-soul-speed"] = "Enchanted with a random level of Soul Speed.", ["enchant-randomly-treasure"] = "All enchantments are equally probable, including treasure enchantments, and any level of the enchantment is equally probable.", ["enchant-with-levels-20-39"] = "Enchantment probabilities are the same as a level-20 to level-39 enchantment would be on an enchantment table that had no cap at level 30, and that was able to apply treasure enchantments, 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 enchantments, 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." },

--  -- NOTE: order here doesn't matter. --		 * in the table, chests will sort in alphabetical order --      * in the table, items will sort by chance, then by avg#, then alphabetically. --      * If poolsJavaUpcoming is omitted, poolsJava will be used. To omit a pool entirely, set it to {}. --      * If poolsBedrock is omitted, it implies that Bedrock has the same pools as Java. This is a shortcoming; it ought to be made explicit somehow. chests = { ["shipwreck-map"] = { -- shipwreck_map.json header = "Map", superheader = "Shipwreck", link  = "shipwreck map", structure = "Shipwreck", container = "Map chest", structID = "shipwreck", pools = { {					{"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 header = "Supply", superheader = "Shipwreck", link  = "shipwreck supply", structure = "Shipwreck", container = "Supply chest", structID = "shipwreck", pools = { {					{"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 header = "Treasure", superheader = "Shipwreck", link  = "shipwreck treasure", structure = "Shipwreck", container = "Treasure chest", structID = "shipwreck", pools = { {					{"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 header = "Buried treasure", link  = "buried treasure", structure = "Buried treasure", container = "", structID = "buried-treasure", pools = { {					{"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 header = "Big", superheader = "Underwater ruins", link  = "big underwater ruins", structure = "Underwater ruins", container = "Big chest", structID = "underwater-ruins", pools = { {					{"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 header = "Small", superheader = "Underwater ruins", link  = "small underwater ruins", structure = "Underwater ruins", container = "Small chest", structID = "underwater-ruins", pools = { {					{"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 header = "Armorer", superheader = "Village", link  = "village armorer", structure = "Village", container = "Armorer's chest", structID = "village", pools = { {					{"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 header = "Butcher", superheader = "Village", link  = "village butcher", structure = "Village", container = "Butcher's chest", structID = "village", pools = { {					{"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 header = "Cartographer", superheader = "Village", link  = "village cartographer", structure = "Village", container = "Cartographer's chest", structID = "village", pools = { {					{"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 header = "Fisherman", superheader = "Village", link  = "village fisherman", structure = "Village", container = "Fisherman's chest", structID = "village", pools = { {					{"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 header = "Fletcher", superheader = "Village", link  = "village fletcher", structure = "Village", container = "Fletcher's chest", structID = "village", pools = { {					{"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 header = "Mason", superheader = "Village", link  = "village mason", structure = "Village", container = "Mason's chest", structID = "village", pools = { {					{"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 header = "Shepherd", superheader = "Village", link  = "village shepherd", structure = "Village", container = "Shepherd's chest", structID = "village", pools = { {					{"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 header = "Tannery", superheader = "Village", link  = "village tannery", structure = "Village", container = "Tanner's chest", structID = "village", pools = { {					{"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 header = "Temple", superheader = "Village", link  = "village temple", structure = "Village", container = "Temple chest", structID = "village", pools = { {					{"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 header = "Toolsmith", superheader = "Village", link  = "village toolsmith", structure = "Village", container = "Toolsmith's chest", structID = "village", pools = { {					{"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 header = "Weaponsmith", superheader = "Village", link  = "village weaponsmith", structure = "Village", container = "Weaponsmith's chest", structID = "village", pools = { {					{"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 header = "Desert House", superheader = "Village", link  = "desert village house", structure = "Village", container = "Desert house chest", structID = "village", pools = { {					{"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 header = "Plains house", superheader = "Village", link  = "plains village house", structure = "Village", container = "Plains house chest", structID = "village", pools = { {					{"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 header = "Savanna house", superheader = "Village", link  = "savanna village house", structure = "Village", container = "Savanna house chest", structID = "village", pools = { {					{"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 header = "Snowy house", superheader = "Village", link  = "snowy village house", structure = "Village", container = "Snowy house chest", structID = "village", pools = { {					{"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 header = "Taiga house", superheader = "Village", link  = "taiga village house", structure = "Village", container = "Taiga house chest", structID = "village", pools = { {					{"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 header     = "Altar", superheader = "Stronghold", link       = "stronghold altar", structure = "Stronghold", container = "Altar chest", structID = "stronghold", pools = { {					{"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 header     = "Library", superheader = "Stronghold", link       = "stronghold library", structure = "Stronghold", container = "Library chest", structID = "stronghold", pools = { {					{"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 header     = "Storeroom", superheader = "Stronghold", link       = "stronghold storeroom", structure = "Stronghold", container = "Storeroom chest", structID = "stronghold", pools = { {					{"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 header = "Bonus", link  = "bonus", structure = "Bonus chest", container = "", structID = "day", pools = { {					{"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 header = "Dungeon", link  = "dungeon", structure = "Dungeon", container = "", structID = "Dungeon", pools = { {					{"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_type = "minecart with chest", header = "Mineshaft", link  = "Mineshafts", structure = "Mineshaft", container = "", structID = "abandoned-mineshaft", pools = { {					{"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 header = "nether fortress", link  = "nether fortress", structure = "Nether fortress", container = "", structID = "nether-fortress", pools = { {					{"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 header = "Desert temple", link  = "desert temple", structure = "Desert temple", container = "", structID = "desert-temple", pools = { {					{"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 header = "Jungle temple", link  = "jungle temple", structure = "Jungle temple", container = "Chest", structID = "jungle-temple", pools = { {					{"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_type = "dispenser", link  = "jungle temples", structure = "Jungle temple", container = "Dispenser", structID = "jungle-temple", pools = { {					{"java"}, {						rolls = {1,2}, items = { ["arrow"] = {2,7,30} }					},				},				{					{"bedrock"}, {						rolls = {2,2}, items = { ["arrow"] = {2,7,30} }					},				},			},		},		["end-city"] = { -- end_city_treasure.json header = "End city", link  = "End city", structure = "End city", container = "", structID = "end-city", pools = { {					{"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}, ["enchanted-diamond-sword"]     = {1,1,3}, ["enchanted-diamond-boots"]     = {1,1,3}, ["enchanted-diamond-chestplate"] = {1,1,3}, ["enchanted-diamond-leggings"]  = {1,1,3}, ["enchanted-diamond-helmet"]    = {1,1,3}, ["enchanted-diamond-pickaxe"]   = {1,1,3}, ["enchanted-diamond-shovel"]    = {1,1,3}, ["enchanted-iron-sword"]        = {1,1,3}, ["enchanted-iron-boots"]        = {1,1,3}, ["enchanted-iron-chestplate"]   = {1,1,3}, ["enchanted-iron-leggings"]     = {1,1,3}, ["enchanted-iron-helmet"]       = {1,1,3}, ["enchanted-iron-pickaxe"]      = {1,1,3}, ["enchanted-iron-shovel"]       = {1,1,3}, }					},				},			},		},		["igloo"] = { header = "Igloo", link  = "igloo", structure = "Igloo", container = "", structID = "igloo", pools = { {					{"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"] = { header = "Pillager outpost", link  = "pillager outpost", structure = "Pillager Outpost", container = "", structID = "pillager-outpost", pools = { {					{"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 header = "Bastion bridge", link = "bastion remnant bridge", structure = "Bastion remnant", container = "", structID = "bastion-remnant", pools = { {					{"java","bedrock"}, {						rolls = {1,1}, items = { ["lodestone"] = {1,1,1}, }					},					{						rolls = {1,2}, items = { ["spectral-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 header = "Bastion hoglin stable", link = "bastion remnant hoglin stable", structure = "Bastion remnant", container = "", structID = "bastion-remnant", pools = { {					{"java","bedrock"}, {						rolls = {1,1}, items = { ["random-enchanted-damaged-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 header = "Bastion other", link = "bastion remnant other", structure = "Bastion remnant", container = "", structID = "bastion-remnant", pools = { {					{"java","bedrock"}, {						rolls = {1,1}, items = { ["random-enchanted-damaged-crossbow"] = {1,1,10}, ["ancient-debris"] = {1,1,5}, ["netherite-scrap"] = {1,1,5}, ["spectral-arrow"] = {5,20,10}, ["piglin-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}, ["enchanted-golden-boots-soul-speed"] = {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"] = {2,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 header = "Bastion treasure", link = "bastion remnant treasure", structure = "Bastion remnant", container = "", structID = "bastion-remnant", pools = { {					{"java","bedrock"}, {						rolls = {1,1}, items = { ["netherite-ingot"] = {1,1,10}, ["ancient-debris"] = {1,1,10}, ["netherite-scrap"] = {1,1,10}, ["ancient-debris"] = {2,2,5}, ["random-enchanted-damaged-netherite-sword"] = {1,1,10}, ["random-enchanted-damaged-netherite-chestplate"] = {1,1,6}, ["random-enchanted-damaged-netherite-helmet"] = {1,1,6}, ["random-enchanted-damaged-netherite-leggings"] = {1,1,6}, ["random-enchanted-damaged-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-leggings"] = {1,1,5}, ["damaged-netherite-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}, }					},				},			},		},		["ruined-portal"] = { --ruined_portal.json header = "Ruined Portal", link  = "ruined portal", structure = "Ruined portal", container = "", structID = "ruined-portal", pools = { {					{"java","bedrock"}, {						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,40}, ["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-pickaxe"] = {1,1,15}, ["random-enchanted-golden-shovel"] = {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,13,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 header = "Woodland Mansion", link  = "woodland mansion", structure = "Woodland mansion", container = "", structID = "woodland-mansion", pools = { {					{"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-treasure"] = {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}, }					},				},			},		},	},

-- these descriptions are the column text. columns = { ["stacksize"] = 'The size of stacks (or for unstackable items, number) of this item on any given roll.', ["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 number of chests the player should expect to search, to find any of this item.' }, }

p.itemtable = 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( p.items ) do			table.insert( item_names, item_name ) end else item_names = mw.text.split( args[1], ',' ) end local single_item = q.has_one_entry( item_names ) -- error message for unknown items for x, item_name in pairs( item_names ) do		if p.items[item_name] == nil then error_msg = error_msg .. " Unknown item '" .. item_name .. "'. \n" end end -- calculate the chances, change from an associative array to an array, and sort local chances_hash = p.find_chances_for_items( item_names ) local chances_list = {} for key, editions in pairs( chances_hash ) do		table.insert( chances_list, { key, editions } ) end table.sort( chances_list, function(a,b) return a[1] < b[1] end ) -- build the html local html = {} local item_expanded = {} local chest_expanded = {} local chances, key, editions local key_split, item_display_name, item_key, chest_key, chance, stacksize

table.insert( html, error_msg ) if q.has_entries( chances_list ) then table.insert( html, '{| class="wikitable sortable" \n' ) if not single_item then table.insert( html, '! Item \n' ) end table.insert( html, '! Container \n' ) table.insert( html, '! # Stacks \n' ) table.insert( html, '!  Stack Size \n' ) table.insert( html, '!  Weight \n' ) table.insert( html, '!  # Items \n' ) table.insert( html, '!  Chance \n' ) table.insert( html, '!  # Chests \n' ) table.insert( html, '! Java \n! Bedrock \n' ) end for _, chances in pairs( chances_list ) do		key = chances[1] editions = chances[2] key_split = q.split( key, '/' ) item_key = key_split[1] chest_key = key_split[2] chance = key_split[3] stacksize = key_split[4] if p.items[item_key].title ~= nil then item_display_name = p.items[item_key].title else item_display_name = q.titlecase( string.gsub( item_key, '-', ' ' ) ) end local java_cell, bedrock_cell if editions['java'] ~= nil and editions['java-upcoming'] == nil then java_cell = q.planned_cell .. ' ' .. q.java_until_cell elseif editions['java'] == nil and editions['java-upcoming'] ~= nil then java_cell = q.planned_cell .. ' ' .. q.java_upcoming_cell elseif editions['java'] ~= nil and editions['java-upcoming'] ~= nil then java_cell = q.yes_cell else java_cell = q.no_cell end if editions['bedrock'] ~= nil and editions['bedrock-upcoming'] == nil then bedrock_cell = q.planned_cell .. ' ' .. q.bedrock_until_cell elseif editions['bedrock'] == nil and editions['bedrock-upcoming'] ~= nil then bedrock_cell = q.planned_cell .. ' ' .. q.bedrock_upcoming_cell elseif editions['bedrock'] ~= nil and editions['bedrock-upcoming'] ~= nil then bedrock_cell = q.yes_cell else bedrock_cell = q.no_cell end if not single_item and item_expanded[item_key] == nil then item_expanded[item_key] = p.get_item( item_key, item_display_name ) end if chest_expanded[chest_key] == nil then chest_expanded[chest_key] = p.current_frame:expandTemplate{ title = 'EnvLink', args = { p.chests[chest_key].structure, id = p.chests[chest_key].structID } } end table.insert( html, '|-\n' ) if not single_item then table.insert( html, "|" .. item_expanded[item_key] .. "\n" ) end table.insert( html, "|" .. chest_expanded[chest_key] .. " " ) table.insert( html, string.gsub( p.chests[chest_key].container, ' ', ' ' ) .. '\n' ) table.insert( html, "|style='text-align:center;'|" .. 0 .. '\n' ) table.insert( html, "|style='text-align:center;'|" .. stacksize .. '\n' ) table.insert( html, "|style='text-align:center;'|" .. 0 .. '\n' ) table.insert( html, "|style='text-align:center;'|" .. 0 .. '\n' ) table.insert( html, "|style='text-align:center;'|" .. chance .. '%\n' ) table.insert( html, "|style='text-align:center;'|" .. 0 .. '\n' ) table.insert( html, '|' .. java_cell .. '\n' ) table.insert( html, '|' .. bedrock_cell .. '\n' ) end if q.has_entries( chances_list ) then table.insert( html, '|}\n' ) table.insert( html, p.current_frame:extensionTag( 'references', "", { group="note" } ) ) end return table.concat( html ) end

p.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 = p.items[item_key][1] local note_key = p.items[item_key].note if p.items[item_key].title ~= nil then item_title = p.items[item_key].title end if p.items[item_key].link ~= nil then item_link = p.items[item_key].link end if p.items[item_key].id ~= nil then item_id = p.items[item_key].id	end if sprite_type == "item" or sprite_type == "block" then table.insert( html, p.current_frame:expandTemplate{ title = q.titlecase(sprite_type) .. 'Link', args = { item_link, item_title , id = item_id } } ) end if note_key ~= nil and note_key ~= "" then table.insert( html, p.current_frame:extensionTag( 'ref', p.notes[note_key], { group='note', name=note_key } ) ) end return table.concat( html ) end

p.find_chances_for_items = function( item_names ) local chances = {} local lang = mw.getContentLanguage for chest_name, chest in pairs(p.chests) do		for _, poolset in pairs(chest.pools or {}) do			local chest_has_java = false local chest_has_java_upcoming = false local chest_has_bedrock = false local chest_has_bedrock_upcoming = false for _, edition in pairs(poolset[1]) do				chest_has_java = chest_has_java or edition == 'java' chest_has_java_upcoming = chest_has_java_upcoming or edition == 'java-upcoming' chest_has_bedrock = chest_has_bedrock or edition == 'bedrock' chest_has_bedrock_upcoming = chest_has_bedrock_upcoming or edition == 'bedrock-upcoming' end if chest_has_java and not chest_has_java_upcoming then table.insert( poolset[1], 'java-upcoming' ) end if chest_has_bedrock and not chest_has_bedrock_upcoming then table.insert( poolset[1], 'bedrock-upcoming' ) end for _, item_name in pairs(item_names) do				local poolset_chances_per_stacksize = {} for pool_idx, pool in pairs(poolset) do					if pool_idx > 1 then local poolitem = pool.items[item_name] if poolitem ~= nil then local stacksize = poolitem[1] if poolitem[1] ~= poolitem[2] then stacksize = stacksize .. "–" .. poolitem[2] end local itemweight = poolitem[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 = q.round( p.calc_chance_any_of_this_item_per_pool( pool.rolls[1], pool.rolls[2], itemweight, pool_total_item_weight ), 3 ) if poolset_chances_per_stacksize[stacksize] == nil then poolset_chances_per_stacksize[stacksize] = chance else poolset_chances_per_stacksize[stacksize] = poolset_chances_per_stacksize[stacksize] + (1 - poolset_chances_per_stacksize[stacksize]) * chance end end end end for stacksize, chance in pairs( poolset_chances_per_stacksize ) do local key = item_name .. '/' .. chest_name .. '/' .. lang:formatNum( chance * 100 ) .. '/' .. stacksize if chances[key] == nil then chances[key] = {} end for _, edition in pairs(poolset[1]) do						chances[key][edition] = true end end end end end return chances end

q = {

-- these templates should only get expanded once. java_upcoming_expanded = nil, java_until_expanded = nil, bedrock_upcoming_expanded = nil, bedrock_until_expanded = nil, yes_expanded = nil, no_expanded = nil, planned_expanded = nil, unknown_expanded = nil, java_upcoming_cell = function if q.java_upcoming_expanded == nil then q.java_upcoming_expanded = p.current_frame:expandTemplate{ title = 'Upcoming', args = { 'JE ' .. p['java-upcoming-version'] } } end return q.java_upcoming_expanded end, java_until_cell = function if q.java_until_expanded == nil then q.java_until_expanded = p.current_frame:expandTemplate{ title = 'Until', args = { 'JE ' .. p['java-upcoming-version'] } } end return q.java_until_expanded end, bedrock_upcoming_cell = function if q.bedrock_upcoming_expanded == nil then q.bedrock_upcoming_expanded = p.current_frame:expandTemplate{ title = 'Upcoming', args = { 'BE ' .. p['bedrock-upcoming-version'] } } end return q.bedrock_upcoming_expanded end, bedrock_until_cell = function if q.bedrock_until_expanded == nil then q.bedrock_until_expanded = p.current_frame:expandTemplate{ title = 'Until', args = { 'BE ' .. p['bedrock-upcoming-version'] } } end return q.bedrock_until_expanded end, yes_cell = function if q.yes_expanded == nil then q.yes_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Yes' } } end return q.yes_expanded end, no_cell = function if q.no_expanded == nil then q.no_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'No' } } end return q.no_expanded end, planned_cell = function if q.planned_expanded == nil then q.planned_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Planned', 'Yes' } } end return q.planned_expanded end, unknown_cell = function if q.unknown_expanded == nil then q.unknown_expanded = p.current_frame:expandTemplate{ title = 'Table Choice', args = { 'Unknown' } } .. ' ' .. p.current_frame:expandTemplate{ title = 'needs testing', args = { 'This loot information has not been tested, in this edition.' } } end return q.unknown_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, numDecimalPlaces) local mult = 10^(numDecimalPlaces 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, titlecase = 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, }

return p