Applied Energistics 2

Applied Energistics 2

137M Downloads

Autocrafting Stuck: Prepared Ingredient Substitution Not Used When Crafting

Niko-O opened this issue ยท 0 comments

commented

Describe the bug

When there are two autocrafting recipes present that create a crafting chain, with the first recipe accepting substitutions but not the second one, autocrafting calculates ingredients correctly with a substitution for the first step, but actual crafting is done with the non-substituted ingredients that were intended for the second step. That second crafting step now can't complete because it does not accept the leftover (substituted) ingredients.
Example:
2x Oak Planks -> 4x Stick, Substitutions enabled
6x Oak Planks + 1x Stick -> 3x Oak Sign, Substitutions disabled
When crafting 12x Oak Sign, autocrafting correctly reserves 26x Oak Planks if they are available. But if only 24x Oak Planks are available, it correctly reserves an additional 2x Birch Planks (substitute items for Oak Planks) to craft the Sticks with, and 24x Oak Planks for the Oak Signs. However, the actual crafting will use Oak Planks for the Sticks, which is wrong, because now there are not enough remaining Oak Planks to craft the actual Oak Signs, since those don't accept the Birch Planks.

How to reproduce the bug

Used test setup:

  • Creative Energy Cell
  • ME Chest with 256k ME Item Storage Cell
  • 256k Crafting Storage
  • ME Pattern Provider
  • Molecular Assembler
  • An ME Pattern Encoding Terminal on a piece of Fluix ME Glass Cable

Test Setup
Two Crafting Patterns created in the ME Pattern Encoding Terminal:

  • 2x Oak Planks -> 4x Stick, Substitutions enabled
  • 6x Oak Planks + 1x Stick -> 3x Oak Sign, Substitutions disabled

Stick Recipe
Sign Recipe

Patterns placed in the ME Pattern Provider. The order does not seem to matter.
2x Birch Planks and 24x Oak Planks stored in the system. This is exactly enough material to craft 12 Oak Signs, using the two Birch Planks to create the Sticks.

To trigger the problem, trigger a crafting request by clicking on the Oak Sign autocraftable, selecting 12 Oak Signs and clicking "Next" in the "Select Amount" screen and finally "Start" in the "Crafting Plan" screen.
Note that the available ingredients are sufficient, according to the Crafting Plan.

Crafting Plan

Click on the hammer button (top right corner) to open the autocrafting status UI and observe the stuck autocrafting job.

Crafting Status

It will eventually settle on this state:

  • Scheduled: 3x Oak Sign
  • Available: 4x Oak Planks
  • Available: 2x Birch Planks
  • Available: 1x Stick

This is because two Oak Planks were used to craft the sticks, but the Oak Sign cannot be crafted with Birch Planks, so it's stuck now.
This does not cause anything to be written to the console.
Following these steps reproduces the issue every time.

Expected behavior

Autocrafting should use the same exact ingredients for each performed crafting step that were calculated in the crafting plan.
In the example above, the 2x Oak Planks -> 4x Stick crafting step should use the Birch Planks that were originally selected as a substitution for it, instead of choosing the Oak Planks that were selected for the 6x Oak Planks + 1x Stick -> 3x Oak Sign crafting step.

Additional details

This problem originally surfaced while playing the "All the Mods 9" pack (with the recipe chain Oak Planks -> Chest -> Oak Drawer), but it is perfectly reproducable with just:

  • Minecraft 1.20.1
  • Forge 47.2.19
  • LWJGL 3 3.3.1 (Automatically selected by Prism Launcher)
  • Applied Energistics 2 15.0.20

And no other mods installed.

Special thanks to @n4imLess for testing this with me.

Which minecraft version are you using?

1.20

On which mod loaders does it happen?

Forge

Crash log

https://gist.github.com/Niko-O/0053f7fcb9b8195a20c5df8f364eac90