Autocrafting

Autocrafting is one of the primary functions of AE2. Instead of manually having to craft the correct number of each sub-ingredient and labor away like some sort of plebian, you can ask your ME system to do it for you. Or automatically craft items and export them somewhere. Or automatically keep certain amounts of items in stock through clever emergent behavior. It also works with fluids, and, if you have certain addons for extra mod material types, like Mekanism gasses, those materials too. It's pretty great.

It is quite a complex topic, so strap in and let's go.

An autocrafting setup consists of 3 things:

Here is what happens:

  1. Something creates a crafting request. This can be you in the terminal clicking on something autocraftable, or an export bus or interface with a crafting card requesting one of the item they're set to export/stock.
  1. The ME system calculates the required ingredients and prerequisite crafting steps to fulfill the request, and stores them in the selected crafting CPU
  2. The ME Pattern Provider with the relevant pattern pushes the ingredients specified in the pattern to any adjacent inventory. In the case of a crafting table recipe (a "crafting pattern") this will be a Molecular Assembler . In the case of a non-crafting recipe (a "processing pattern") this will be some other block or machine or elaborate redstone-controlled setup.
  3. The result of the craft is returned to the system somehow, be it by import bus, interface, or pushing the result back into a pattern provider. Note that an "item entering system" event must occur, you can't just pipe the result into a chest with a ME Storage Bus on it.
  4. If that craft is a prerequisite for another craft in the request, the items are stored in that crafting CPU and then used in that craft.

Recursive Recipes

One thing the autocrafting algorithm cannot handle is recursive recipes. For example, duplication recipes like "1 redstone dust = 2 redstone dust", from throwing redstone in a Botania manapool. Another example would be smithing templates in vanilla Minecraft. However, there is a way to handle these recipes.

Patterns

Patterns are made in a ME Pattern Encoding Terminal out of blank patterns.

There are several different types of pattern for different things:

Multiple ME Pattern Provider s with identical patterns are supported and work in parallel. Additionally, you can have a pattern say, for example, 8 cobblestone = 8 stone instead of 1 cobblestone = 1 stone, and the pattern provider will insert 8 cobblestone into your smelting setup every operation instead of one at a time.

The Most General Form of "Pattern"

There is actually an even more "general" form of "pattern" than a processing pattern. A ME Level Emitter with a crafting card can be set to emit a redstone signal in order to craft something. This "pattern" does not define, or even care about ingredients. All it says is "If you emit redstone from this level emitter, the ME system will recieve this item at some point in the near or distant future". This is usually used to activate and deactivate infinite farms which require no input ingredients, or to activate a system that handles recursive recipes (which standard autocafting cannot understand) like, for example, "1 cobblestone = 2 cobblestone" if you have a machine that duplicates cobblestone.

The Crafting CPU

Crafting CPUs manage crafting requests/jobs. They store the intermediate ingredients while crafting jobs with multiple steps are being carried out, and affect how big jobs can be, and to some degree how fast they are completed. They are multiblocks, and must be rectangular prisms with at least 1 crafting storage.

Crafting CPUs are made out of:

Each crafting CPU handles 1 request or job, so if you want to request both a calculation processor and 256 smooth stone at once, you need 2 CPU multiblocks.

They can be set to handle requests from players, automation (export busses and interfaces), or both.

Pattern Providers

ME Pattern Provider s are the primary way in which your autocrafting system interacts with the world. They push the ingredients in their patterns to adjacent inventories, and items can be inserted into them in order to insert them into the network. Often a channel can be saved by piping the output of a machine back into a nearby pattern provider (often the one that pushed the ingredients) instead of using an ME Import Bus to pull the output of the machine into the network.

Of note, since they push the ingredients directly from the crafting storage in a crafting CPU, they never actually contain the ingredients in their inventory, so you cannot pipe out from them. You have to have the provider push to another inventory (like a barrel) then pipe from that.

Also of note, the provider has to push ALL of the ingredients at once, it can't push half-batches. This is useful to exploit.

Pattern providers have a special interaction with interfaces on subnets: if the interface is unmodified (nothing in the request slots) the provider will skip the interface entirely and push directly to that subnet's storage, skipping the interface and not filling it with recipe batches, and more importantly, not inserting the next batch until there's space in storage.

Multiple pattern providers with identical patterns are supported and work in parallel.

Pattern providers will attempt to round-robin their batches to all of their faces, thus using all attached machines in parallel.

Variants

Pattern Providers come in 3 different variants: normal, directional, and flat. This affects which specific sides they push ingredients to, receive items from, and provide a network connection to.

Pattern providers can be swapped between normal and flat in a crafting grid.

Settings

Pattern providers have a variety of modes:

Priority

Priorities can be set by clicking the wrench in the top-right of the GUI. In the case of several patterns for the same item, patterns in providers with higher priority will be used over patterns in providers with lower priority, unless the network does not have the ingredients for the higher priority pattern.

Molecular Assemblers

The Molecular Assembler takes items input into it and carries out the operation defined by an adjacent ME Pattern Provider , or the inserted Crafting Pattern , Smithing Table Pattern , or Stonecutting Pattern , then pushes the result to adjacent inventories.

Their main use is next to a ME Pattern Provider . Pattern providers have special behavior in this case, and will send information about the relevant pattern along with the ingredients to adjacent assemblers. Since assemblers auto-eject the results of crafts to adjacent inventories (and thus into the return slots of the pattern provider), an assembler on a pattern provider is all that is needed to automate crafting patterns.