diff options
author | Jason Mitchell <mitchej@gmail.com> | 2021-05-23 15:52:51 -0700 |
---|---|---|
committer | Jason Mitchell <mitchej+github@gmail.com> | 2021-05-23 18:24:20 -0700 |
commit | c39086946112174b81612e7fd96a2ce0ad056620 (patch) | |
tree | 13635ebf033a51300a00d366dfd42bd7052a5f32 /src/main/java/gregtech/api/util/GT_ModHandler.java | |
parent | 5a1d6f0cb01c78b6133c7e1acbbd80b848a68ab6 (diff) | |
download | GT5-Unofficial-c39086946112174b81612e7fd96a2ce0ad056620.tar.gz GT5-Unofficial-c39086946112174b81612e7fd96a2ce0ad056620.tar.bz2 GT5-Unofficial-c39086946112174b81612e7fd96a2ce0ad056620.zip |
It's ugly, but it works.
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_ModHandler.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_ModHandler.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 484e4d29b9..f82b0ecb7e 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -63,6 +63,7 @@ import java.util.stream.Collectors; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.B; + import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.DW; import static gregtech.api.enums.GT_Values.E; @@ -1332,6 +1333,7 @@ public class GT_ModHandler { delayedRemovalByRecipe.add(aCrafting); } + @SuppressWarnings("unchecked") public static void bulkRemoveByRecipe(List<InventoryCrafting> toRemove) { ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); GT_FML_LOGGER.info("BulkRemoveByRecipe: tList: " + tList.size() + " toRemove: " + toRemove.size() ); @@ -1483,14 +1485,23 @@ public class GT_ModHandler { * Used for Recipe Detection. */ public static ItemStack getRecipeOutput(ItemStack... aRecipe) { - return getRecipeOutput(false, aRecipe); + return getRecipeOutput(false, true, aRecipe); } - + + public static ItemStack getRecipeOutputNoOreDict(ItemStack... aRecipe) { + return getRecipeOutput(false,false, aRecipe); + } + + public static ItemStack getRecipeOutput(boolean aUncopiedStack, ItemStack... aRecipe) { + return getRecipeOutput(aUncopiedStack, true, aRecipe); + } + /** * Gives you a copy of the Output from a Crafting Recipe * Used for Recipe Detection. */ - public static ItemStack getRecipeOutput(boolean aUncopiedStack, ItemStack... aRecipe) { + @SuppressWarnings("unchecked") + public static ItemStack getRecipeOutput(boolean aUncopiedStack, boolean allowOreDict, ItemStack... aRecipe) { if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return null; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @@ -1505,6 +1516,8 @@ public class GT_ModHandler { for (IRecipe iRecipe : tList) { found = false; + if (!allowOreDict && iRecipe instanceof ShapedOreRecipe) continue; + try { found = iRecipe.matches(aCrafting, DW); } catch (Throwable e) { |