Infinite loop on start up with invalid recepies #162


Open
  • sirintellegence created this issue Oct 13, 2020

    I apologize ahead of time for using a decompiler to figure out how things went wrong since I couldn't find a source link.

    Anywho, when using a server like Magma (https://github.com/magmafoundation/Magma/issues/264), there is a possibility that a recipe provided to "getIngredients" will return an empty collection, mostly due to Forge recipes not being compatible. Then the system apparently goes into an infinite loop in "propogateEnergiesThroughCrafting()". This is because the ingredients are never not known because there are no ingredients. Then it adds a zero entry in "addEnergyPossibility" which triggeres "somethingChanged" to true and the loop eventually restarts.

    I have been able to fix this by patch compiling the boolean and Hashmap declaration into the following:

        HashMap<MaterialData, Integer> ingredients = getIngredients(recipe);
        boolean ingredientsKnown = !ingredients.isEmpty();

    It no longer loops infinitely now since we don't know the ingredients in an empty list. This was discoverd with the 3.1.0 build and I confirmed the bug still possibly exists by looking at the current one. I have not done any extended testing on this fix.


To post a comment, please login or register a new account.