local function mod_loaded(name) return (minetest.get_modpath(name) ~= nil) end local sieving_items = {} sieving_items["default:dirt"] = { "default:sand", } sieving_items["default:dirt_with_coniferous_litter"] = { "default:sand", } sieving_items["default:dirt_with_dry_grass"] = { "default:sand", "default:dry_grass_1", } sieving_items["default:dirt_with_grass"] = { "default:sand", "default:grass_1", } sieving_items["default:dirt_with_rainforest_litter"] = { "default:sand", } sieving_items["default:dirt_with_snow"] = { "default:sand", "default:snow" } sieving_items["default:dry_dirt"] = { "default:deset_sand", } sieving_items["default:dry_dirt_with_dry_grass"] = { "default:desert_sand", "default:dry_grass_1", } if mod_loaded("farming") then -- normal table.insert(sieving_items["default:dirt"], "farming:seed_wheat") table.insert(sieving_items["default:dirt"], "farming:seed_cotton") -- slightly dry and cold table.insert(sieving_items["default:dirt_with_coniferous_litter"], "farming:seed_wheat") -- slightly dry table.insert(sieving_items["default:dirt_with_dry_grass"], "farming:seed_cotton") -- slightly wet table.insert(sieving_items["default:dirt_with_grass"], "farming:seed_wheat") table.insert(sieving_items["default:dirt_with_grass"], "farming:seed_cotton") -- wet table.insert(sieving_items["default:dirt_with_rainforest_litter"], "farming:seed_wheat") -- cold table.insert(sieving_items["default:dirt_with_snow"], "farming:seed_wheat") -- dry table.insert(sieving_items["default:dry_dirt"], "farming:seed_cotton") -- dry table.insert(sieving_items["default:dry_dirt_with_dry_grass"], "farming:seed_cotton") if farming.mod and farming.mod == "redo" then table.insert(sieving_items["default:dirt"], "farming:seed_rye") table.insert(sieving_items["default:dirt"], "farming:seed_oat") table.insert(sieving_items["default:dirt"], "farming:seed_barley") table.insert(sieving_items["default:dirt"], "farming:seed_rice") table.insert(sieving_items["default:dirt_with_coniferous_litter"], "farming:seed_rye") table.insert(sieving_items["default:dirt_with_coniferous_litter"], "farming:seed_oat") table.insert(sieving_items["default:dirt_with_dry_grass"], "farming:seed_rye") table.insert(sieving_items["default:dirt_with_dry_grass"], "farming:seed_oat") table.insert(sieving_items["default:dirt_with_dry_grass"], "farming:seed_barley") table.insert(sieving_items["default:dirt_with_grass"], "farming:seed_oat") table.insert(sieving_items["default:dirt_with_grass"], "farming:seed_rice") table.insert(sieving_items["default:dirt_with_rainforest_litter"], "farming:seed_oat") table.insert(sieving_items["default:dirt_with_rainforest_litter"], "farming:seed_rice") table.insert(sieving_items["default:dirt_with_snow"], "farming:seed_rye") table.insert(sieving_items["default:dirt_with_snow"], "farming:seed_oat") table.insert(sieving_items["default:dry_dirt"], "farming:seed_oat") table.insert(sieving_items["default:dry_dirt"], "farming:seed_barley") table.insert(sieving_items["default:dry_dirt_with_dry_grass"], "farming:seed_rye") table.insert(sieving_items["default:dry_dirt_with_dry_grass"], "farming:seed_oat") table.insert(sieving_items["default:dry_dirt_with_dry_grass"], "farming:seed_barley") end end if mod_loaded("ethereal") then table.insert(sieving_items["default:dirt"], "ethereal:worm") table.insert(sieving_items["default:dirt_with_coniferous_litter"], "ethereal:worm") table.insert(sieving_items["default:dirt_with_grass"], "ethereal:worm") table.insert(sieving_items["default:dirt_with_rainforest_litter"], "ethereal:worm") sieving_items["ethereal:bamboo_dirt"] = { "default:sand", "default:grass_1", "ethereal:worm" } sieving_items["ethereal:cold_dirt"] = { "default:sand", "default:grass_1" } sieving_items["ethereal:crystal_dirt"] = { "default:sand", } sieving_items["ethereal:gray_dirt"] = { "default:sand", "ethereal:worm" } sieving_items["ethereal:grove_dirt"] = { "default:sand", "default:grass_1", "ethereal:worm" } sieving_items["ethereal:jungle_dirt"] = { "default:sand", "ethereal:worm" } sieving_items["ethereal:mushroom_dirt"] = { "default:sand", "ethereal:worm" } sieving_items["ethereal:dry_dirt"] = { "default:desert_sand", } sieving_items["ethereal:fiery_dirt"] = { "default:desert_sand", } sieving_items["ethereal:prairie_dirt"] = { "default:sand", "default:grass_1", "ethereal:worm" } if mod_loaded("farming") then table.insert(sieving_items["ethereal:bamboo_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:bamboo_dirt"], "farming:seed_cotton") table.insert(sieving_items["ethereal:cold_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_cotton") table.insert(sieving_items["ethereal:grove_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:jungle_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:dry_dirt"], "farming:seed_cotton") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_wheat") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_cotton") if farming.mod and farming.mod == "redo" then table.insert(sieving_items["ethereal:bamboo_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:bamboo_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:bamboo_dirt"], "farming:seed_rice") table.insert(sieving_items["ethereal:cold_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:cold_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:crystal_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:crystal_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_barley") table.insert(sieving_items["ethereal:gray_dirt"], "farming:seed_rice") table.insert(sieving_items["ethereal:grove_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:grove_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:grove_dirt"], "farming:seed_barley") table.insert(sieving_items["ethereal:jungle_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:jungle_dirt"], "farming:seed_barley") table.insert(sieving_items["ethereal:jungle_dirt"], "farming:seed_rice") table.insert(sieving_items["ethereal:dry_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:dry_dirt"], "farming:seed_barley") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_rye") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_oat") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_barley") table.insert(sieving_items["ethereal:prairie_dirt"], "farming:seed_rice") end end end if mod_loaded("bbq") then table.insert(sieving_items["default:dirt"], "bbq:yeast") table.insert(sieving_items["default:dirt_with_coniferous_litter"], "bbq:yeast") table.insert(sieving_items["default:dirt_with_grass"], "bbq:yeast") table.insert(sieving_items["default:dirt_with_rainforest_litter"], "bbq:yeast") if mod_loaded("ethereal") then table.insert(sieving_items["ethereal:bamboo_dirt"], "bbq:yeast") table.insert(sieving_items["ethereal:gray_dirt"], "bbq:yeast") table.insert(sieving_items["ethereal:grove_dirt"], "bbq:yeast") table.insert(sieving_items["ethereal:jungle_dirt"], "bbq:yeast") table.insert(sieving_items["ethereal:mushroom_dirt"], "bbq:yeast") table.insert(sieving_items["ethereal:prairie_dirt"], "bbq:yeast") end end if mod_loaded("bonemeal") then table.insert(sieving_items["default:dirt"], "bonemeal:bone") table.insert(sieving_items["default:dirt_with_coniferous_litter"], "bonemeal:bone") table.insert(sieving_items["default:dirt_with_dry_grass"], "bonemeal:bone") table.insert(sieving_items["default:dirt_with_grass"], "bonemeal:bone") table.insert(sieving_items["default:dirt_with_rainforest_litter"], "bonemeal:bone") table.insert(sieving_items["default:dirt_with_snow"], "bonemeal:bone") table.insert(sieving_items["default:dry_dirt"], "bonemeal:bone") table.insert(sieving_items["default:dry_dirt_with_dry_grass"], "bonemeal:bone") if mod_loaded("ethereal") then table.insert(sieving_items["ethereal:bamboo_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:cold_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:crystal_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:gray_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:grove_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:jungle_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:mushroom_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:dry_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:fiery_dirt"], "bonemeal:bone") table.insert(sieving_items["ethereal:prairie_dirt"], "bonemeal:bone") end end local sieving_items_count = {} for dirt, items in pairs(sieving_items) do sieving_items_count[dirt] = #items end local function sieve(dirt) local items = sieving_items[dirt] if math.random(7) ~= 1 then return ItemStack(items[1]) else return ItemStack( items[ math.random(sieving_items_count[dirt]) ] ) end end local function sieve_dirt(dirt) return function() return sieve(dirt) end end for dirt, _ in pairs(sieving_items) do techage.register_sieving_recipe(dirt, sieve_dirt(dirt)) end