-- override the protection function to handle the
-- sealing spell and amulets
do local nextfn = minetest.is_protected
	minetest.is_protected = function(pos,name)
		local meta = minetest.get_meta(pos)
		if meta:contains('owner') and meta:contains('sorcery_wand_key') then
			if meta:get_string('sorcery_seal_mode') == 'wand' or name ~= meta:get_string('owner') then
				return true
			end
		end
		return nextfn(pos,name)
	end
end

if minetest.get_modpath('hopper') then
	hopper:add_container {
		{'side',  'group:sorcery_device_generator','fuel'};
		{'bottom','group:sorcery_device_generator','fuel'};

		{'side',  'sorcery:coin_press','ingot'};
		{'bottom','sorcery:coin_press','gem'};
		-- output handled on our side; requires automation

		{'bottom','sorcery:infuser','infusion'};
		{'side',  'sorcery:infuser','potions'};
		-- output handled on our side

		{'top',   'sorcery:displacer','cache'};
		{'side',  'sorcery:displacer','cache'};
		{'bottom','sorcery:displacer','cache'};

		{'side','sorcery:displacer_transmit_gem','code'};
		{'side','sorcery:displacer_receive_gem', 'code'};

		{'side','group:sorcery_device_kiln','fuel'};
		{'top', 'group:sorcery_device_kiln','output'};

		{'top',   'group:sorcery_device_smelter','output'};
		{'bottom','group:sorcery_device_smelter','input'};
		{'side',  'group:sorcery_device_smelter','fuel'};

		{'top',    'sorcery:mill', 'output'};
		{'side',   'sorcery:mill', 'grinder'};
		{'bottom', 'sorcery:mill', 'input'};

		{'bottom', 'sorcery:harvester', 'charge'};
		-- output handled on our side
	}
end
