Properly handle multiple cookable drops
This commit is contained in:
parent
4cef3ba46f
commit
94d6bd9b44
17
init.lua
17
init.lua
@ -113,10 +113,13 @@ function lavastuff.burn_drops(tool)
|
||||
-- loop through current node drops
|
||||
for _, drop in pairs(drops) do -- get cooked output of current drops
|
||||
local stack = ItemStack(drop)
|
||||
local output = minetest.get_craft_result({
|
||||
local safety = 0
|
||||
|
||||
repeat
|
||||
local output, leftover = minetest.get_craft_result({
|
||||
method = "cooking",
|
||||
width = 1,
|
||||
items = {drop}
|
||||
items = {stack:to_string()}
|
||||
})
|
||||
|
||||
for _, name in pairs(lavastuff.blacklisted_items) do
|
||||
@ -133,8 +136,18 @@ function lavastuff.burn_drops(tool)
|
||||
count = output.item:to_table().count,
|
||||
})
|
||||
)
|
||||
|
||||
stack = leftover.items[1]
|
||||
else -- if not then return normal drops
|
||||
table.insert(hot_drops, stack)
|
||||
stack = nil
|
||||
end
|
||||
|
||||
safety = safety + 1
|
||||
until (safety > 999 or not stack or stack:get_count() <= 0)
|
||||
|
||||
if safety > 999 then
|
||||
minetest.log("error", "[lavastuff]: Something went wrong with drop cooking")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user