From b8b592220b7c568bc46402b112696a66c8208deb Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Fri, 6 Apr 2018 19:28:23 +1000 Subject: $ Rolled back handling to a point where it works much better. --- .../machines/multi/misc/GMTE_AmazonPackager.java | 87 ++++++++-------------- 1 file changed, 31 insertions(+), 56 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index c81983ac79..865b8b7bf4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -102,70 +102,45 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(ItemStack aStack) { + ArrayList tItems = getStoredInputs(); + if (this.getGUIItemStack() != null) { + tItems.add(this.getGUIItemStack()); - boolean h[] = new boolean[mInputBusses.size()]; - int count = 0; - for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { - ArrayList tBusItems = new ArrayList(); - tBus.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tBus)) { - for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) - tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - - if (this.getGUIItemStack() != null) { - tBusItems.add(this.getGUIItemStack()); - } + } + ArrayList tFluids = getStoredFluids(); + ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); + FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); + boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000); - ArrayList tFluids = getStoredFluids(); - ItemStack[] tItemInputs = tBusItems.toArray(new ItemStack[tBusItems.size()]); - FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000); - if (state) { - h[count++] = true; - continue; - } - else { - AutoMap mCompleted = new AutoMap(); - AutoMap mSchematics = new AutoMap(); - for (ItemStack tInputItem : tBusItems) { - if (tInputItem != null) { - if (ItemList.Schematic_1by1.isStackEqual((Object) tInputItem) || ItemList.Schematic_2by2.isStackEqual((Object) tInputItem) || ItemList.Schematic_3by3.isStackEqual((Object) tInputItem)) { - mSchematics.put(new ItemStackData(tInputItem)); - } + + if (state) { + return true; + } + else { + tItems = getStoredInputs(); + AutoMap mCompleted = new AutoMap(); + AutoMap mSchematics = new AutoMap(); + for (ItemStack tInputItem : tItems) { + if (tInputItem != null) { + if (ItemList.Schematic_1by1.isStackEqual((Object) tInputItem) || ItemList.Schematic_2by2.isStackEqual((Object) tInputItem) || ItemList.Schematic_3by3.isStackEqual((Object) tInputItem)) { + mSchematics.put(new ItemStackData(tInputItem)); } } - if (mSchematics.size() > 0) { - for (ItemStackData g : mSchematics) { - for (ItemStack tInputItem : tBusItems) { - if (tInputItem != null) { - mCompleted.put(new ItemStackData(tInputItem)); - checkRecipe(tInputItem, g.getStack()); - } + } + if (mSchematics.size() > 0) { + for (ItemStackData g : mSchematics) { + for (ItemStack tInputItem : tItems) { + if (tInputItem != null) { + mCompleted.put(new ItemStackData(tInputItem)); + checkRecipe(tInputItem, g.getStack()); } } } - - if (mCompleted != null && mCompleted.size() > 0) { - h[count++] = true; - continue; - } - else { - h[count++] = false; - continue; - } - } - - } - for (boolean b : h) { - if (!b) { - return false; } - } - return true; + + return mCompleted != null && mCompleted.size() > 0; + } } public boolean checkRecipe(ItemStack inputStack, ItemStack schematicStack) { -- cgit