aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2023-12-18 17:12:17 +0900
committerGitHub <noreply@github.com>2023-12-18 17:12:17 +0900
commitea023026fe683255944586d60f036ff07de8ffa2 (patch)
treef680c1e064af67d88709727a0aa19e7c683ecc3d /src
parentd58290144c30fce4ca5f0524dd83eaa54f211dec (diff)
downloadGT5-Unofficial-ea023026fe683255944586d60f036ff07de8ffa2.tar.gz
GT5-Unofficial-ea023026fe683255944586d60f036ff07de8ffa2.tar.bz2
GT5-Unofficial-ea023026fe683255944586d60f036ff07de8ffa2.zip
Clarify whether item or fluid output is full (#2403)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java11
-rw-r--r--src/main/java/gregtech/api/util/GT_ParallelHelper.java11
-rw-r--r--src/main/java/gregtech/api/util/VoidProtectionHelper.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java2
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang3
6 files changed, 59 insertions, 5 deletions
diff --git a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
index f162c892ee..4dc0b80b93 100644
--- a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
+++ b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
@@ -49,10 +49,19 @@ public final class CheckRecipeResultRegistry {
*/
public static final CheckRecipeResult NO_RECIPE = SimpleCheckRecipeResult.ofFailure("no_recipe");
/**
- * Cannot process recipe because output is full.
+ * @deprecated Use either of {@link #ITEM_OUTPUT_FULL} or {@link #FLUID_OUTPUT_FULL}.
*/
+ @Deprecated
public static final CheckRecipeResult OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("output_full");
/**
+ * Cannot process recipe because item output is full.
+ */
+ public static final CheckRecipeResult ITEM_OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("item_output_full");
+ /**
+ * Cannot process recipe because fluid output is full.
+ */
+ public static final CheckRecipeResult FLUID_OUTPUT_FULL = SimpleCheckRecipeResult.ofFailure("fluid_output_full");
+ /**
* Default unknown state.
*/
public static final CheckRecipeResult NONE = SimpleCheckRecipeResult.ofFailure("none");
diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java
index 0f0dc4549f..e836122f37 100644
--- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java
+++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java
@@ -341,6 +341,9 @@ public class GT_ParallelHelper {
* Called by build(). Determines the parallels and everything else that needs to be done at build time
*/
protected void determineParallel() {
+ if (maxParallel <= 0) {
+ return;
+ }
if (itemInputs == null) {
itemInputs = new ItemStack[0];
}
@@ -412,8 +415,12 @@ public class GT_ParallelHelper {
.setMaxParallel(maxParallel)
.build();
maxParallel = Math.min(voidProtectionHelper.getMaxParallel(), maxParallel);
- if (maxParallel <= 0) {
- result = CheckRecipeResultRegistry.OUTPUT_FULL;
+ if (voidProtectionHelper.isItemFull()) {
+ result = CheckRecipeResultRegistry.ITEM_OUTPUT_FULL;
+ return;
+ }
+ if (voidProtectionHelper.isFluidFull()) {
+ result = CheckRecipeResultRegistry.FLUID_OUTPUT_FULL;
return;
}
}
diff --git a/src/main/java/gregtech/api/util/VoidProtectionHelper.java b/src/main/java/gregtech/api/util/VoidProtectionHelper.java
index 440d8e63ef..3a41bba934 100644
--- a/src/main/java/gregtech/api/util/VoidProtectionHelper.java
+++ b/src/main/java/gregtech/api/util/VoidProtectionHelper.java
@@ -36,6 +36,14 @@ public class VoidProtectionHelper {
*/
private int maxParallel = 1;
/**
+ * If item output is full.
+ */
+ private boolean isItemFull;
+ /**
+ * If fluid output is full.
+ */
+ private boolean isFluidFull;
+ /**
* The item outputs to check
*/
private ItemStack[] itemOutputs;
@@ -111,6 +119,26 @@ public class VoidProtectionHelper {
}
/**
+ * @return If the calculation resulted in item output being full.
+ */
+ public boolean isItemFull() {
+ if (!built) {
+ throw new IllegalStateException("Tried to get isItemFull before building");
+ }
+ return isItemFull;
+ }
+
+ /**
+ * @return If the calculation resulted in fluid output being full.
+ */
+ public boolean isFluidFull() {
+ if (!built) {
+ throw new IllegalStateException("Tried to get isFluidFull before building");
+ }
+ return isFluidFull;
+ }
+
+ /**
* Called by {@link #build()}. Determines the parallels and everything else that needs to be done at build time
*/
private void determineParallel() {
@@ -125,9 +153,16 @@ public class VoidProtectionHelper {
// to allow more involved setting for void protections (see ComplexParallelProcessingLogic)
if (protectExcessItem && itemOutputs.length > 0 && !machine.canDumpItemToME()) {
maxParallel = Math.min(calculateMaxItemParallels(), maxParallel);
+ if (maxParallel <= 0) {
+ isItemFull = true;
+ return;
+ }
}
if (protectExcessFluid && fluidOutputs.length > 0 && !machine.canDumpFluidToME()) {
maxParallel = Math.min(calculateMaxFluidParallels(), maxParallel);
+ if (maxParallel <= 0) {
+ isFluidFull = true;
+ }
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index d1d56f0254..254f5bf0b0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -217,7 +217,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
if (pumpResult.getType() != ValidationType.VALID) {
mEUt = 0;
mMaxProgresstime = 0;
- setRuntimeFailureReason(CheckRecipeResultRegistry.OUTPUT_FULL);
+ setRuntimeFailureReason(CheckRecipeResultRegistry.FLUID_OUTPUT_FULL);
return false;
}
FluidStack tFluid = pumpResult.getResult();
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index 3b6c868977..e719f8db0f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -248,7 +248,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
ItemStack[] toOutput = getOutputByDrops(oreBlockDrops);
if (simulate && !canOutputAll(toOutput)) {
- setRuntimeFailureReason(CheckRecipeResultRegistry.OUTPUT_FULL);
+ setRuntimeFailureReason(CheckRecipeResultRegistry.ITEM_OUTPUT_FULL);
return false;
}
mOutputItems = toOutput;
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index f76c25ef71..0b8a0ac734 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -420,7 +420,10 @@ GT5U.gui.button.drill_retract_pipes_active=§4Cannot interrupt abort procedure
GT5U.gui.text.success=§aProcessing recipe
GT5U.gui.text.generating=§aGenerating power
GT5U.gui.text.no_recipe=§7No valid recipe found
+#deprecated
GT5U.gui.text.output_full=§7Not enough output space
+GT5U.gui.text.item_output_full=§7Not enough item output space
+GT5U.gui.text.fluid_output_full=§7Not enough fluid output space
GT5U.gui.text.none=
GT5U.gui.text.crash=§4Machine turned off due to crash
GT5U.gui.text.no_fuel=§7No valid fuel found