TheCodex6824 / ThaumcraftFix

GNU General Public License v3.0
8 stars 3 forks source link

Error in log with IC2 Classic + Thaumic JEI #27

Closed xJon closed 4 months ago

xJon commented 4 months ago

https://mclo.gs/83IX6kD

Might already be resolved by Thaumcraft Fix, and originally reported over https://github.com/TinyModularThings/IC2Classic/issues/1151. I still figured to document it here, although it currently has a workaround implemented by @Speiger for the latest version of IC2C, who said it is a Thaumcraft bug:

Basically they call: getRemainingItems without calling matches first. That put the recipe into an invalid state causing the crash. Note if matches returns false then it shouldn't be calling getRemainingItems either. It's a vanilla interface. For crafting recipes.

TheCodex6824 commented 4 months ago

Looks like the original thinking was probably that all of the input ingredients get copied into a fake crafting inventory before calling getRemainingItems so it's safe. Unfortunately, this doesn't work for dynamic recipes (which I'm guessing is what that recipe with error was) because they don't have a static list of ingredients to return in their recipe.

The arcane workbench fix included with this mod fixes a similar issue with the workbench handling vanilla crafting recipes, but it's a different issue than this instance.

Speiger commented 4 months ago

@TheCodex6824 yeah in ic2cs case we are caching the offset of the result that ShapedRecipe also uses for the matches function. That cache is used for stackcrafting to ensure the correct items are used by the recipe.

xJon commented 4 months ago

I believe https://github.com/TheCodex6824/ThaumcraftFix/commit/3ae435267d3e9455da61c9220f482d4c54a58074 resolved this, and the issue can be closed?

Speiger commented 4 months ago

It should fix it but i would test it first

xJon commented 4 months ago

@Speiger I have tested with IC2 Classic version 1.5.9 (pre-workaround) and there's still no error in the log when Thaumcraft Fix is present 👍

TheCodex6824 commented 4 months ago

Right, that commit should have fixed it. We also won't proceed now if matches returns false.

Not related to IC2 Classic, but you might want to check aspects on your items - as part of this fix I had to fix how Thaumcraft inserted the items into the fake crafting grid because it was wrong for recipes that didn't take up the full 3x3 grid. I think I have everything correct with that, but please double-check my work there.

xJon commented 4 months ago

@TheCodex6824 Are there any specific items to check the aspects for?

TheCodex6824 commented 4 months ago

@TheCodex6824 Are there any specific items to check the aspects for?

I have to get around to writing automated tests for this mod at some point so we don't have to worry as much about these things, but these kinds of items should cover the different things that can happen:

If you do find an issue, you should probably open a new issue so we don't keep spamming Speiger :)