aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim <maxim235@gmx.de>2023-07-25 19:00:45 +0200
committerGitHub <noreply@github.com>2023-07-25 19:00:45 +0200
commit11c85d4807f43acc7df2d91ef415d7931230bb77 (patch)
treed77d1f3d6e9b9e337b62eef5c2ffb4c84ae0e966 /src
parent13b2b3f90b690f7f58659df41bc1186679f8b351 (diff)
downloadGT5-Unofficial-11c85d4807f43acc7df2d91ef415d7931230bb77.tar.gz
GT5-Unofficial-11c85d4807f43acc7df2d91ef415d7931230bb77.tar.bz2
GT5-Unofficial-11c85d4807f43acc7df2d91ef415d7931230bb77.zip
Fixed mass fab sometimes crashing in scrap mode (#706)
* Fixed mass fab sometimes crashing in scrap mode * Also skip invalid items * Removed unncessary null check * Revert skip behavior and added custom running text for when the item doesnt yield scrap
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java47
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang1
2 files changed, 34 insertions, 14 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
index 0098ed207f..1b13eae309 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -33,7 +33,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.recipe.check.FindRecipeResult;
+import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.util.GTPP_Recipe;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_ModHandler;
@@ -228,22 +230,39 @@ public class GregtechMetaTileEntity_MassFabricator
@NotNull
@Override
+ protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) {
+ if (mMode == MODE_SCRAP) {
+ if (recipe.mOutputs == null) {
+ return SimpleCheckRecipeResult.ofSuccess("no_scrap");
+ }
+ }
+ return CheckRecipeResultRegistry.SUCCESSFUL;
+ }
+
+ @NotNull
+ @Override
protected FindRecipeResult findRecipe(GT_Recipe_Map map) {
if (mMode == MODE_SCRAP) {
- ItemStack aPotentialOutput = GT_ModHandler
- .getRecyclerOutput(GT_Utility.copyAmount(1, inputItems[0]), 0);
- GT_Recipe recipe = new GTPP_Recipe(
- false,
- new ItemStack[] { GT_Utility.copyAmount(1, inputItems[0]) },
- aPotentialOutput == null ? null : new ItemStack[] { aPotentialOutput },
- null,
- new int[] { 2000 },
- null,
- null,
- 40,
- MaterialUtils.getVoltageForTier(1),
- 0);
- return FindRecipeResult.ofSuccess(recipe);
+ if (inputItems != null) {
+ for (ItemStack item : inputItems) {
+ if (item == null || item.stackSize == 0) continue;
+ ItemStack aPotentialOutput = GT_ModHandler
+ .getRecyclerOutput(GT_Utility.copyAmount(1, item), 0);
+ GT_Recipe recipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] { GT_Utility.copyAmount(1, item) },
+ aPotentialOutput == null ? null : new ItemStack[] { aPotentialOutput },
+ null,
+ new int[] { 2000 },
+ null,
+ null,
+ 40,
+ MaterialUtils.getVoltageForTier(1),
+ 0);
+ return FindRecipeResult.ofSuccess(recipe);
+ }
+ }
+ return FindRecipeResult.NOT_FOUND;
}
return super.findRecipe(map);
}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index 717377a845..c849d5f01d 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -14,6 +14,7 @@ GT5U.gui.text.no_catalyst=§7No valid catalyst found
GT5U.gui.text.no_milling_ball=§7No milling ball found
GT5U.gui.text.growing_trees=§aGrowing trees
GT5U.gui.text.managing_power=§aManaging power
+GT5U.gui.text.no_scrap=§aInput too low quality
GT5U.gui.text.warm_up=§aWarming up
GT5U.gui.text.machine_locked_to_different_recipe=§7Machine is already locked to a different recipe