aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces
diff options
context:
space:
mode:
authorboubou19 <miisterunknown@gmail.com>2023-04-03 13:43:11 +0200
committerGitHub <noreply@github.com>2023-04-03 12:43:11 +0100
commit99ebf025c6b6813f809ec45780799e74f766df92 (patch)
treea53143b0f999aa11e931cb344ae92907443d2cd9 /src/main/java/gregtech/api/interfaces
parent3eee273dec666877722937af3e3c5082e3a97d4e (diff)
downloadGT5-Unofficial-99ebf025c6b6813f809ec45780799e74f766df92.tar.gz
GT5-Unofficial-99ebf025c6b6813f809ec45780799e74f766df92.tar.bz2
GT5-Unofficial-99ebf025c6b6813f809ec45780799e74f766df92.zip
Fix RA2 bugs (#1830)
* fix pulverizer chances mistakes * fix block version of the PBF * use properly RA2 for PBF recipes * spotlessApply (#1831) Co-authored-by: GitHub GTNH Actions <> * enable lots of materials by default * fixes, documentation, and minor api contract update * spotless --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r--src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java b/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java
index 69f87161d1..bbc2fd4ada 100644
--- a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java
+++ b/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java
@@ -18,7 +18,13 @@ public interface IGT_RecipeMap {
/**
* Add a downstream recipe map that will get to handle the original builder.
- *
+ *
+ * Downstream recipe maps got passed the recipe builder after parent recipe map is done with its business. Notice
+ * at this time the original recipe builder might be modified by the parent recipe map in some form, but it will
+ * remain as valid.
+ *
+ * A downstream will only be invoked if parent recipe map added something.
+ *
* @param downstream
*/
void addDownstream(IGT_RecipeMap downstream);
@@ -53,9 +59,13 @@ public interface IGT_RecipeMap {
@Override
public Collection<GT_Recipe> doAdd(GT_RecipeBuilder builder) {
List<Collection<GT_Recipe>> ret = new ArrayList<>();
- ret.add(func.apply(builder));
- for (IGT_RecipeMap downstream : downstreams) {
- ret.add(downstream.doAdd(builder));
+ Collection<GT_Recipe> out = func.apply(builder);
+ ret.add(out);
+ builder.clearInvalid();
+ if (!out.isEmpty()) {
+ for (IGT_RecipeMap downstream : downstreams) {
+ ret.add(downstream.doAdd(builder));
+ }
}
return GT_Utility.concat(ret);
}