I made a few farms in my survival world to get the ingredients for cake. I made an automatic chicken farm for the eggs, a cow farm for the milk, and an automatic sugar can farm for the sugar can and sugar. They all go to a centralized hopper. Now I want to know how to automate the crafting process. I tried putting a crafting table underneath the hopper, so the ingredients will craft and then get sent to the hopper underneath, which will get delivered to a chest. However, that didn't work, because the ingredients got sent in and random times, meaning sometimes the sugar cane went in first, sometimes the sugar went first, etc. Is there a way I can control the flow of ingredients to automate the crafting process?
Autocrafting is a much requested feature, but not one that currently exists in Vanilla Minecraft. Many mods add it, but all of them in their own way, so there is no general answer for those either.
Some people, like members of the Scicraft server, have automated crafting as far as possible, by building a redstone machine that puts a shulker box full of resources in one spot, letting their computer use a click macro to quickly take items out of it, craft them and put the result back in, which the machine detects, crushes the shulker box and places a new one, repeating the cycle.
One tutorial for such a machine is here (disclaimer: I have not watched that video myself, I just know that type of machine and that Ilmango has used them in the past).
A lot of items that are usually crafted can also be automated in unusual ways. For example bowls drop from turtles (which can be bred by holding one button) that get struck by lightning, endermen can hold melons and drop them as full blocks when killed, fishing and mob drops can give you lots of different items that would usually be crafted, including leads from wandering traders and so on.
In theory you could even farm raids or patrols, then convert the pillager banners to banners with one less layer on them using cauldrons by dropping the banners onto you while holding the "use" button and looking at a cauldron, which gets occasionally refilled by rain, then repeat the process more times to remove more layers. That would be a way to farm a theoretically infinite amount of white banners (very slowly) without needing a click macro.
But there is no such method for cake.
Automated crafting is currently not possible in Minecraft Java Edition. There are mods and data packs which add this functionality though.
RFTools Control allows for completely automated, redundant crafting using not only crafting table recipes but also crafting recipes for machines added by other mods.
By redundant I mean it will fetch and/or craft ingredients for all subcomponents of the current requested crafting result. It's frankly OP, if you know how to program the processor to do it.