Shadows-of-Fire / Shadows-of-Greg

An addon for GregTech Community Edition with the goal of making it much more complicated and realistic through the use of GregTech 5 Unofficial and GregTech 6 features.
GNU General Public License v3.0
16 stars 30 forks source link

Recipe additions doesn't check for recipes with 0 ingredients. #166

Closed Drillgon200 closed 3 years ago

Drillgon200 commented 3 years ago

Got a crash report from a player recently, tracked it to here. https://github.com/Shadows-of-Fire/Shadows-of-Greg/blob/0b7dffe002abb0f119f0017521d05726b62705cd/src/main/java/gregicadditions/recipes/GARecipeAddition.java#L721

While most of it seems to check the size of ingredients, this line of code doesn't, which crashes with my dynamic recipes that are purposefully designed to not have a persistent set of ingredients. Should be an easy fix.

Here's the crash report from their issue. https://pastebin.com/39vY5NQB

Exaxxion commented 3 years ago

That is very uh, non-canonical behavior to say the least. It doesn't really make any sense for a recipe to have no ingredients.

phantamanta44 commented 3 years ago

recipe_with_no_ingredients

phantamanta44 commented 3 years ago

it seems like you've both misdiagnozed this issue: the problem is that in this line:

ModHandler.addShapelessRecipe("log_to_4_" + recipe.getRecipeOutput().toString(), GTUtility.copyAmount(4, recipe.getRecipeOutput()), recipe.getIngredients().get(0).getMatchingStacks()[0], ToolDictNames.craftingToolSaw);

...the result of getMatchingStack() is empty, and not that recipe.getIngredients() is empty. this is simply SoG being uncareful about recipes that might potentially be unsatisfiable

Exaxxion commented 3 years ago

Yeah, you're right phanta, it's the array index access [0] not the .get(0).get... that is causing the AIOOBE. This is the first time we've been made aware of a basic log-to-planks crafting table recipe that doesn't match its own recorded ingredients, which is still quite weird.

We'll look into it.

Drillgon200 commented 3 years ago

Oh weird, I wonder what recipe it was then. I just kind of assumed it was MKU because that one is generally a weird recipe that has already caused issues with other mods. Hopefully that'll fix it in any case.