Compare commits

..

No commits in common. "siev_rec" and "master" have entirely different histories.

View File

@ -73,25 +73,14 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
return stack:get_count() return stack:get_count()
end end
local sieving_recipes = {}
function techage.register_sieving_recipe(material, get_ore_func)
sieving_recipes[ItemStack(material)] = get_ore_func
end
techage.register_sieving_recipe("techage:basalt_gravel", get_random_basalt_ore)
techage.register_sieving_recipe("default:gravel", get_random_gravel_ore)
local function sieving(pos, crd, nvm, inv) local function sieving(pos, crd, nvm, inv)
local src, dst
for i = 1, crd.num_items do for i = 1, crd.num_items do
local src, dst if inv:contains_item("src", ItemStack("techage:basalt_gravel")) then
for input_material, get_ore_func in pairs(sieving_recipes) do dst, src = get_random_basalt_ore(), ItemStack("techage:basalt_gravel")
if inv:contains_item("src", ItemStack(input_material)) then elseif inv:contains_item("src", ItemStack("default:gravel")) then
dst, src = get_ore_func(), ItemStack(input_material) dst, src = get_random_gravel_ore(), ItemStack("default:gravel")
break else
end
end
if dst == nil then
crd.State:idle(pos, nvm) crd.State:idle(pos, nvm)
return return
end end