diff options
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 2 | ||||
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java | 29 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 98a2d9635d..4059c6cd92 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -573,6 +573,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler(new HashSet<>(0), "ic.recipe.recycler", "Recycler", "ic2.recycler", RES_PATH_GUI + "basicmachines/Recycler", 1, 1, 1, 0, 1, E, 1, E, true, false); public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace(new HashSet<>(0), "mc.recipe.furnace", "Furnace", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false); public static final GT_Recipe_Map sMicrowaveRecipes = new GT_Recipe_Map_Microwave(new HashSet<>(0), "gt.recipe.microwave", "Microwave", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false); + + /** Set {@code aSpecialValue = -100} to bypass the disassembler tier check and default recipe duration. */ public static final GT_Recipe_Map sDisassemblerRecipes = new GT_Recipe_Map(new HashSet<>(250), "gt.recipe.disassembler", "Disassembler", null, RES_PATH_GUI + "basicmachines/Disassembler", 1, 9, 1, 0, 1, E, 1, E, true, false); public static final GT_Recipe_Map sScannerFakeRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Scanner", 1, 1, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map(new HashSet<>(200), "gt.recipe.rockbreaker", "Rock Breaker", null, RES_PATH_GUI + "basicmachines/RockBreaker", 1, 1, 0, 0, 1, E, 1, E, true, true); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 02eb893ba0..b79869497a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -167,9 +167,6 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi ) return DID_NOT_FIND_RECIPE; - if (checkTier(is)) - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - Integer handleHardOverride = handleHardOverride(is); if (handleHardOverride != null) return handleHardOverride; @@ -236,17 +233,31 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); if (gt_recipe == null) return DID_NOT_FIND_RECIPE; - if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) - return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize) - ? FOUND_AND_SUCCESSFULLY_USED_RECIPE - : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) { + if (gt_recipe.mSpecialValue == -100) { + // Bypass standard disassembler restrictions. + this.getInputAt(0).stackSize -= gt_recipe.mInputs[0].stackSize; + System.arraycopy(gt_recipe.mOutputs, 0, this.mOutputItems, 0, gt_recipe.mOutputs.length); + + this.calculateOverclockedNess(gt_recipe); + return FOUND_AND_SUCCESSFULLY_USED_RECIPE; + } else { + return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize) + ? FOUND_AND_SUCCESSFULLY_USED_RECIPE + : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + } + } return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){ - if (this.getInputAt(0).stackSize >= stackSize) - this.getInputAt(0).stackSize -= stackSize; + ItemStack machineInput = this.getInputAt(0); + if (checkTier(machineInput)) + return false; + + if (machineInput.stackSize >= stackSize) + machineInput.stackSize -= stackSize; else return false; |