-- tweaks

minetest.register_craft {
	type = "shapeless";
	recipe = {
		"group:water_bucket",
		"vessels:glass_bottle",
		"vessels:glass_bottle",
		"vessels:glass_bottle"
	};
	output = "sorcery:potion_water 3";
	replacements = {
		{ "group:water_bucket", "bucket:bucket_empty" }
	};
}
minetest.register_craft {
	output = 'dye:white 4';
	recipe = {
		{'',           'sorcery:ash',             ''};
		{'sorcery:ash','basic_materials:paraffin','sorcery:ash'};
		{'',           'bucket:bucket_water',     ''};
	};
	replacements = {
		{'bucket:bucket_water', 'bucket:bucket_empty'};
	};
};

minetest.register_craft {
	type = "shapeless";
	recipe = {
		"bucket:bucket_empty";
		"sorcery:potion_water";
		"sorcery:potion_water";
		"sorcery:potion_water";
	};
	output = "bucket:bucket_water";
	replacements = {
		{ "sorcery:potion_water", "vessels:glass_bottle" };
		{ "sorcery:potion_water", "vessels:glass_bottle" };
		{ "sorcery:potion_water", "vessels:glass_bottle" };
	};
}

minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'group:scissors';
		'basic_materials:plastic_sheet';
	};
	output = 'basic_materials:plastic_strip 3';
	replacements = {
		{'group:scissors','group:scissors'};
	};
}

minetest.register_craft {
	recipe = {
		{"", "default:gold_ingot"},
		{"default:bronze_ingot",""}
	};
	output = "sorcery:dagger";
}

---- magitech

-- infuser
minetest.register_craftitem('sorcery:infuser_tube', {
	inventory_image = 'sorcery_infuser_tube.png';
	description = 'Infusion Tube';
	groups = {
		sorcery_magitech = 1; metal = 1;
		sorcery_tech_component = 1;
	};
})
minetest.register_craft {
	recipe = {
		{"basic_materials:copper_strip",'sorcery:infuser_concentrator', "basic_materials:copper_strip"};
		{"", "basic_materials:copper_strip", "basic_materials:gold_wire"};
		{"", "basic_materials:copper_strip", ""};
	};
	replacements = {
		{"basic_materials:gold_wire", "basic_materials:empty_spool"}
	};
	output = "sorcery:infuser_tube";
}

minetest.register_craftitem('sorcery:infuser_chamber', {
	inventory_image = 'sorcery_infuser_chamber.png';
	description = 'Infusion Chamber';
	groups = {
		sorcery_magitech = 1;
		sorcery_tech_component = 1;
	};
})
minetest.register_craft {
	recipe = {
		{'default:clay_brick','sorcery:grease_sealant','default:clay_brick'};
		{'default:clay_brick','stairs:slab_steelblock','default:clay_brick'};
	};
	replacements = {
		{'sorcery:grease_sealant','xdecor:bowl'};
	};
	output = "sorcery:infuser_chamber";
}

minetest.register_craftitem('sorcery:infuser_concentrator', {
	inventory_image = 'sorcery_infuser_concentrator.png';
	description = 'Infusion Concentrator';
	groups = {
		sorcery_magitech = 1;
		sorcery_tech_component = 1;
	};
})

minetest.register_craft {
	recipe = {
		{'basic_materials:steel_wire'};
		{'default:obsidian_shard'};
		{'basic_materials:copper_wire'};
	};
	replacements = {
		{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
	output = "sorcery:infuser_concentrator";
}

minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'basic_materials:empty_spool';
		'basic_materials:empty_spool';
		'sorcery:infuser_concentrator';
	};
	replacements = {
		{'basic_materials:empty_spool', 'basic_materials:steel_wire'};
		{'basic_materials:empty_spool', 'basic_materials:copper_wire'};
	};
	output = "default:obsidian_shard";
}

minetest.register_craft {
	type = 'shapeless';
	recipe = {
		'xdecor:honey';
		'xdecor:bowl';
		'basic_materials:oil_extract';
	};
	output = "sorcery:grease_sealant";
}

minetest.register_craft {
	recipe = {
		{ 'default:tin_ingot', 'bucket:bucket_empty', 'default:tin_ingot'};
		{ 'default:bronze_ingot', 'sorcery:infuser_chamber', 'default:copper_ingot'};
		{ 'sorcery:infuser_tube', 'sorcery:infuser_tube', 'sorcery:infuser_tube' };
	};
	output = "sorcery:infuser";
}

minetest.register_craft {
	output = "sorcery:displacer";
	recipe = {
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
		{'basic_materials:copper_wire','sorcery:core_syncretic','doors:trapdoor_steel'};
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
	};
	replacements = {
		{'basic_materials:copper_wire','basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_transmit_attune";
	recipe = {
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
		{'sorcery:leyline_stabilizer','sorcery:core_mandatic','sorcery:tuning_disc'};
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_transmit_gem";
	recipe = {
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
		{'sorcery:leyline_stabilizer','sorcery:core_mandatic','sorcery:gem_ruby'};
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_receive_attune";
	recipe = {
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
		{'sorcery:inverter_coil','sorcery:core_mandatic','sorcery:tuning_disc'};
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
	};
}

minetest.register_craft {
	output = "sorcery:displacer_receive_gem";
	recipe = {
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
		{'sorcery:inverter_coil','sorcery:core_mandatic','sorcery:gem_ruby'};
		{'sorcery:platinum_ingot','sorcery:screw_tungsten','sorcery:platinum_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:raycaster';
	recipe = {
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
		{'default:gold_ingot','sorcery:beam_generator','default:gold_ingot'};
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
	};
}

minetest.register_craft {
	output = 'sorcery:tuning_disc';
	recipe = {
		{'sorcery:inverter_coil','sorcery:silver_ingot',''};
		{'sorcery:leyline_stabilizer','sorcery:silver_ingot','sorcery:gem_emerald'};
		{'sorcery:inverter_coil','sorcery:silver_ingot',''};
	};
}

minetest.register_craft {
	output = 'sorcery:farcaster';
	recipe = {
		{'default:gold_ingot','sorcery:iridium_ingot','default:gold_ingot'};
		{'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'};
		{'default:gold_ingot','sorcery:iridium_ingot','default:gold_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:portal_node';
	recipe = {
		{'sorcery:tungsten_ingot','sorcery:core_mandatic','sorcery:tungsten_ingot'};
		{'sorcery:aluminum_ingot','sorcery:platinumblock','sorcery:aluminum_ingot'};
		{'sorcery:tungsten_ingot','sorcery:core_mandatic','sorcery:tungsten_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:portal_reflector';
	recipe = {
		{'basic_materials:steel_bar','default:tin_ingot','basic_materials:steel_bar'};
		{'sorcery:gem_amethyst','sorcery:inverter_coil','sorcery:gem_amethyst'};
		{'basic_materials:steel_bar','xpanes:bar_flat','basic_materials:steel_bar'};
	}
}

minetest.register_craft {
	output = 'sorcery:portal_pad';
	recipe = {
		{'basic_materials:steel_bar','xpanes:bar_flat','basic_materials:steel_bar'};
		{'sorcery:gem_amethyst','sorcery:beam_generator','sorcery:gem_amethyst'};
		{'basic_materials:steel_bar','default:tin_ingot','basic_materials:steel_bar'};
	}
}

minetest.register_craft {
	output = 'sorcery:gravity_manipulator';
	recipe = {
		{'sorcery:cobalt_ingot','sorcery:screw_platinum','basic_materials:silver_wire'};
		{'sorcery:inverter_coil','sorcery:core_counterpraxic','sorcery:levitanium_ingot'};
		{'sorcery:cobalt_ingot','sorcery:screw_platinum','basic_materials:silver_wire'};
	};
}

minetest.register_craft {
	output = 'sorcery:gravitator_off';
	recipe = {
		{'sorcery:platinum_ingot','basic_materials:plastic_sheet','sorcery:platinum_ingot'};
		{'xpanes:pane_flat','sorcery:gravity_manipulator','basic_materials:plastic_sheet'};
		{'sorcery:platinum_ingot','basic_materials:plastic_sheet','sorcery:platinum_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:powder_firestorm 4';
	type = 'shapeless';
	recipe = {
		'sorcery:powder_lithium', 'sorcery:powder_lithium';
		'sorcery:powder_silver';
		'basic_materials:oil_extract';
		'sorcery:flame_oil';
		'tnt:gunpowder';
		'farming:mixing_bowl';
	};
	replacements = {
		{'sorcery:flame_oil', 'xdecor:bowl'};
		{'farming:mixing_bowl', 'farming:mixing_bowl'};
	};
}

for i,e in ipairs{'frost','flame','force'} do
	minetest.register_craftitem('sorcery:essence_'..e, {
		description = sorcery.lib.str.capitalize(e) .. ' Essence';
		inventory_image = 'sorcery_essence_'..e..'.png';
		group = { sorcery_elemental_essence = 1 };
		_sorcery = {
			material = {
				sacrifice_value = i ^ 6;
			}
		}
	})
end

minetest.register_craftitem('sorcery:inferno_crystal', {
	-- made with melding wand from ruby, lithium ingot, and gunpowder
	-- under sign of the wyvern or the winged serpent
	inventory_image = 'sorcery_inferno_crystal.png';
	description = 'Inferno Crystal';
	_sorcery = {
		material = {
			gem = true;
			sacrifice_value = 900;
		};
	}
})

minetest.register_craftitem('sorcery:powder_firestorm', {
	inventory_image = 'sorcery_powder_firestorm.png';
	description = 'Firestorm Powder';
})

minetest.register_craft {
	type = 'fuel', burntime = 8 * 15;
	recipe = 'sorcery:powder_firestorm';
};

minetest.register_craft {
	type = 'fuel', burntime = 8 * 85;
	recipe = 'sorcery:inferno_crystal';
	replacement = {{'sorcery:inferno_crystal', 'sorcery:shard_ruby 6'}};
};

minetest.register_craftitem('sorcery:essence_flame', {
	inventory_image = 'sorcery_essence_flame.png';
	description = 'Flame Essence';
})


minetest.register_craftitem('sorcery:gravity_manipulator', {
	description = 'Gravity Manipulator';
	inventory_image = 'sorcery_gravity_manipulator.png';
	groups = {
		sorcery_magitech = 1;
		sorcery_tech_component = 1;
	};
})

minetest.register_craftitem('sorcery:tuning_disc',{
	description = 'Tuning Disc';
	inventory_image = 'sorcery_tuning_disc.png';
	groups = {
		sorcery_magitech = 1; metal = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:core_counterpraxic',{
	description = 'Counterpraxis Core';
	inventory_image = 'sorcery_core_counterpraxic.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:core_mandatic',{
	description = 'Mandatic Core';
	inventory_image = 'sorcery_core_mandatic.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:core_syncretic',{
	description = 'Syncresis Core';
	inventory_image = 'sorcery_core_syncretic.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:suppression_matrix',{
	description = 'Suppression Matrix';
	inventory_image = 'sorcery_suppression_matrix.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:inverter_coil',{
	description = 'Inverter Coil';
	inventory_image = 'sorcery_inverter_coil.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:beam_generator',{
	description = 'Beam Generator';
	inventory_image = 'sorcery_beam_generator.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:leyline_stabilizer',{
	description = 'Leyline Stabilizer';
	inventory_image = 'sorcery_leyline_stabilizer.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
});

minetest.register_craftitem('sorcery:field_emitter',{
	description = 'Field Emitter';
	inventory_image = 'sorcery_field_emitter.png';
	groups = {
		sorcery_magitech = 1; metal = 1; sorcery_magitech_core = 1;
		sorcery_tech_component = 1;
	};
})

--- possible other components
-- felicitator
-- flux rectifier
-- flux suppressor
-- flux amplifier
-- tacit web
-- radiatic filament
-- radia transducer
-- transductive coil
-- affine macerator
-- state extender
-- state disruptor
-- axial dispulsor
-- aether coruscator

minetest.register_craft {
	output = 'sorcery:leyline_stabilizer';
	recipe = {
		{'basic_materials:copper_wire','group:sorcery_ley_cable','basic_materials:copper_wire'};
		{'sorcery:grease_neutralizing','group:sorcery_ley_cable','sorcery:grease_neutralizing'};
		{'basic_materials:copper_wire','group:sorcery_ley_cable','basic_materials:copper_wire'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'sorcery:grease_neutralizing', 'xdecor:bowl'};
		{'sorcery:grease_neutralizing', 'xdecor:bowl'};
	};
}

minetest.register_craft {
	output = 'sorcery:beam_generator';
	recipe = {
		{'xpanes:bar_flat','xpanes:pane_flat','xpanes:bar_flat'};
		{'sorcery:screw_aluminum','sorcery:gem_sapphire','sorcery:screw_aluminum'};
		{'xpanes:bar_flat','sorcery:gem_luxite','xpanes:bar_flat'};
	};
}

minetest.register_craft {
	output = 'sorcery:suppression_matrix';
	recipe = {
		{'sorcery:fragment_electrum','basic_materials:steel_strip','sorcery:fragment_cobalt'};
		{'basic_materials:copper_strip','xpanes:bar_flat','basic_materials:copper_strip'};
		{'sorcery:fragment_cobalt','basic_materials:steel_strip','sorcery:fragment_electrum'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_counterpraxic';
	recipe = {
		{'sorcery:gem_ruby_shard','sorcery:tungsten_ingot','sorcery:gem_ruby_shard'};
		{'sorcery:tungsten_ingot','sorcery:gem_emerald','sorcery:tungsten_ingot'};
		{'sorcery:gem_ruby_shard','sorcery:tungsten_ingot','sorcery:gem_ruby_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_syncretic';
	recipe = {
		{'sorcery:gem_sapphire_shard','default:gold_ingot','sorcery:gem_sapphire_shard'};
		{'default:gold_ingot','default:diamond','default:gold_ingot'};
		{'sorcery:gem_sapphire_shard','default:gold_ingot','sorcery:gem_sapphire_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:core_mandatic';
	recipe = {
		{'sorcery:gem_amethyst_shard','sorcery:silver_ingot','sorcery:gem_amethyst_shard'};
		{'sorcery:silver_ingot','sorcery:gem_sapphire','sorcery:silver_ingot'};
		{'sorcery:gem_amethyst_shard','sorcery:silver_ingot','sorcery:gem_amethyst_shard'};
	};
}

minetest.register_craft {
	output = 'sorcery:inverter_coil';
	recipe = {
		{'sorcery:screw_platinum','basic_materials:steel_wire','sorcery:screw_platinum'};
		{'basic_materials:copper_wire','default:tin_ingot','basic_materials:copper_wire'};
		{'sorcery:screw_platinum','basic_materials:steel_wire','sorcery:screw_platinum'};
	};
	replacements = {
		{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
		{'basic_materials:steel_wire', 'basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = 'sorcery:field_emitter';
	recipe = {
		{'basic_materials:steel_bar','xpanes:pane_flat','basic_materials:steel_bar'};
		{'sorcery:beam_generator','sorcery:leyline_stabilizer','sorcery:beam_generator'};
		{'sorcery:beam_generator','basic_materials:copper_wire','sorcery:beam_generator'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
}

minetest.register_craft {
	output = 'sorcery:emitter_barrier';
	recipe = {
		{'sorcery:suppression_matrix','sorcery:suppression_matrix','sorcery:suppression_matrix'};
		{'sorcery:field_emitter','sorcery:core_counterpraxic','sorcery:inverter_coil'};
		{'default:tin_ingot','default:tin_ingot','default:tin_ingot'};
	};
}

minetest.register_craft {
	output = 'sorcery:generator';
	recipe = {
		{'sorcery:aluminum_ingot','sorcery:aluminum_ingot','sorcery:aluminum_ingot'};
		{'default:bronze_ingot','basic_materials:copper_wire','default:bronze_ingot'};
		{'default:steel_ingot','default:furnace','default:steel_ingot'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
}

---- writing
minetest.register_craftitem('sorcery:ink', {
	description = "Ink";
	inventory_image = "sorcery_ink_bottle.png";
	groups = { liquid = 1; ink = 1; }
})

minetest.register_craftitem('sorcery:erasure_fluid', {
	description = "Erasure Fluid";
	inventory_image = "sorcery_erasure_fluid_bottle.png";
	groups = { liquid = 1; sorcery_writingstand_operand = 1; }
})

minetest.register_craft {
	output = 'sorcery:ink';
	type = 'shapeless';
	recipe = {
		'sorcery:potion_water';
		'dye:black', 'dye:black', 'dye:black';
		'xdecor:honey';
		'basic_materials:oil_extract';
		'basic_materials:oil_extract';
	};
}

minetest.register_craft {
	output = 'sorcery:erasure_fluid 3';
	type = 'shapeless';
	recipe = {
		'sorcery:potion_water';
		'sorcery:potion_water';
		'sorcery:potion_water';
		'basic_materials:oil_extract';
		'sorcery:powder_aluminum';
		'sorcery:powder_tin';
	}
}

minetest.register_craft {
	output = 'sorcery:erasure_fluid 3';
	type = 'shapeless';
	recipe = {
		'vessels:glass_bottle';
		'vessels:glass_bottle';
		'vessels:glass_bottle';
		'bucket:bucket_water';
		'basic_materials:oil_extract';
		'sorcery:powder_aluminum';
		'sorcery:powder_tin';
	};
	replacements = {
		{'bucket:bucket_water','bucket:bucket_empty'};
	};
}
minetest.register_craft {
	output = 'sorcery:writing_stand';
	recipe = {
		{'screwdriver:screwdriver','default:book','default:gold_ingot'};
		{'sorcery:screw_steel','group:wood','sorcery:screw_steel'};
		{'group:wood','default:stick','group:wood'};
	};
	replacements = {
		{'screwdriver:screwdriver','screwdriver:screwdriver'};
	};
};

sorcery.register.residue.link('sorcery:ink','vessels:glass_bottle')
sorcery.register.residue.link('sorcery:erasure_fluid','vessels:glass_bottle')

---- altar
minetest.register_craftitem('sorcery:candle', {
	-- TODO make candle node
	inventory_image = 'sorcery_candle.png';
	description = 'Votive Candle';
	groups = {
		candle = 1;
	};
})

minetest.register_craft {
	recipe = {
		{'farming:string'};
		{'basic_materials:paraffin'};
		{'basic_materials:paraffin'};
	};
	output = "sorcery:candle";
}

minetest.register_craft {
	recipe = {
		{'sorcery:candle','sorcery:candle','sorcery:candle'};
		{'sorcery:coin_gold','stairs:slab_stone','sorcery:coin_bronze'};
		{'','sorcery:coin_tin',''};
	};
	output = "sorcery:altar";
}
minetest.clear_craft { output = 'morelights:bulb'; }
minetest.register_craft {
	recipe = {
		{'xpanes:pane_flat', 'sorcery:gem_luxite_shard', 'xpanes:pane_flat'};
		{'sorcery:gem_luxite_shard', 'default:mese_crystal_fragment','sorcery:gem_luxite_shard'};
		{'xpanes:pane_flat', 'basic_materials:copper_wire', 'xpanes:pane_flat'};
	};
	replacements = {
		{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	};
	output = 'morelights:bulb 4';
}

local auxdyes = {
	[{'vidrium','iridium','vidrium'}]= 'violet';
	[{'iridium','vidrium','iridium'}]= 'mulberry';
	[{'cobalt','iridium','cobalt'}  ]= 'magenta';
	[{'iridium','cobalt','iridium'} ]= 'fuchsia';
	[{'iridium','gold','iridium'}   ]= 'rose';
	[{'iridium','copper','iridium'} ]= 'crimson';
	[{'aluminum','tin','aluminum'}  ]= 'pink';
	[{'copper','gold','copper'}     ]= 'orange';
	[{'bronze','gold','bronze'}     ]= 'amber';
	[{'bronze','copper','bronze'}   ]= 'brown';
	[{'vidrium','gold','vidrium'}   ]= 'lime';
	[{'vidrium','cobalt','vidrium'} ]= 'cerulean';
	[{'vidrium','cobalt','levitanium'}] = 'azure';
}

for metals,color in pairs(auxdyes) do
	local dye = 'dye:' .. color
	if minetest.registered_items[dye] then
		local pd = {} for i=1,3 do
			pd[i] = sorcery.data.metals[metals[i]].parts.powder
		end
		minetest.register_craft {
			output = dye .. ' 4';
			recipe = {
				{'',    pd[2],                     ''};
				{pd[1],'basic_materials:paraffin', pd[3]};
				{'',   'bucket:bucket_water',      ''};
			};
		}
	end
end

local potion_auto_recipe = function(id, substance, tools, container)
	local recipe = tools
	local replace = {}
	local batches = 1
	for _,v in pairs(tools) do
		replace[#replace + 1] = {v,v}
	end

	if substance.core and #substance.core > 0 then
		batches = #substance.core
		recipe = sorcery.lib.tbl.append(recipe, substance.core)
	elseif container then
		recipe[#recipe + 1] = container
	end
	if substance.mix and #substance.mix > 0 then
		recipe = sorcery.lib.tbl.append(recipe, substance.mix)
		for _,r in pairs(substance.mix) do
			if sorcery.register.residue.db[r] then
				replace[#replace + 1] = {
					r, sorcery.register.residue.db[r]
				}
			end
		end
	end

	minetest.register_craft {
		type = 'shapeless';
		recipe = recipe;
		replacements = replace;
		output = id .. ' ' .. batches;
	}
end
-- auto-generate recipes for potionmaking oils
for n,v in pairs(sorcery.data.oils) do
	if (v.core and #v.core > 0) or (v.mix and #v.mix > 0) then
		local id = 'sorcery:oil_' .. n
		potion_auto_recipe(id,v,{'farming:mortar_pestle'},'xdecor:bowl')
	end
end

for n,v in pairs(sorcery.data.greases) do
	if (v.core and #v.core > 0) or (v.mix and #v.mix > 0) then
		local id = 'sorcery:grease_' .. n
		potion_auto_recipe(id,v,{'farming:mixing_bowl'},'xdecor:bowl')
	end
end
