@@ -451,9 +451,9 @@ if tgt.name == 'sorcery:enchanter' then local meta = minetest.get_meta(ctx.target.under) local inv = meta:get_inventory() if inv:get_stack('item',1):get_name() == 'default:paper' - and inv:get_stack('item',1):get_count() == 1 + -- and inv:get_stack('item',1):get_count() == 1 and not inv:is_empty('foci') then local ink1 = getcolor(inv:get_stack('foci',2)) local ink2 = getcolor(inv:get_stack('foci',3)) local restrict, kind, mod = {} do @@ -525,9 +525,18 @@ -- make recipe for thing in slot 1 else sorcery.cookbook.setrecipe(rec,kind,nil,restrict) end - inv:set_stack('item',1,rec) + local old = inv:get_stack('item',1) + -- TODO: detect hopper underneath and place + -- recipe into it instead of item slot + if old:get_count() == 1 then + inv:set_stack('item',1,rec) + else + old:take_item(1) + inv:set_stack('item',1,old) + minetest.add_item(ctx.target.above,rec) + end for i=1,inv:get_size('foci') do local f = inv:get_stack('foci',i) f:take_item(1) inv:set_stack('foci',i,f)