Add a callback: minetest.register_on_craft(itemstack, player)

This adds a callback when a player crafts something. The callback should return another itemstack, that would replace the original one, or nil, that will not change the itemstack.