From 31be1f73d6e6e3fb599e9470176269cadb83742f Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:19:52 +0800 Subject: Add a sanity check to catch invalid assline recipes (#995) --- src/main/java/gregtech/api/util/GT_Recipe.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 63f46e2c1e..2a0733420f 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -558,6 +558,20 @@ public class GT_Recipe implements Comparable { public static class GT_Recipe_AssemblyLine{ public static final ArrayList sAssemblylineRecipes = new ArrayList(); + static { + GregTech_API.sFirstWorldTick.add(GT_Recipe_AssemblyLine::checkInvalidRecipes); + } + + private static void checkInvalidRecipes() { + boolean foundInvalid = false; + for (GT_Recipe_AssemblyLine recipe : sAssemblylineRecipes) { + if (recipe.getPersistentHash() == 0) + foundInvalid = true; + } + if (foundInvalid) + throw new RuntimeException("There are invalid assembly line recipes! Check logs for details!"); + } + public ItemStack mResearchItem; public int mResearchTime; public ItemStack[] mInputs; -- cgit