From 3e0b96bb2d5a4f881279fbf054f08fbe42743a30 Mon Sep 17 00:00:00 2001 From: "Wong, Dylan" Date: Sun, 4 Feb 2024 00:54:59 -0800 Subject: [PATCH] added iterator override to support custom recipes. --- .../api/recipes/machines/RecipeMapFluidCanner.java | 9 +++++++++ .../api/recipes/machines/RecipeMapFormingPress.java | 9 +++++++++ .../gregtech/api/recipes/machines/RecipeMapScanner.java | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 719cde4c311..466d8bdeda7 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -16,6 +16,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; +import java.util.Iterator; import java.util.List; @ApiStatus.Internal @@ -83,4 +85,11 @@ public Recipe findRecipe(long voltage, List inputs, List } return null; } + + @Override + @NotNull + public Iterator getRecipeIterator(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { + return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator(); + } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index 492ae4080c1..f6f250c1fbb 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -17,6 +17,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; +import java.util.Iterator; import java.util.List; @ApiStatus.Internal @@ -77,4 +79,11 @@ public Recipe findRecipe(long voltage, List inputs, List } return recipe; } + + @Override + @NotNull + public Iterator getRecipeIterator(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { + return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator(); + } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index f76c7b10814..249ff7f0233 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -14,6 +14,8 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; import java.util.List; @ApiStatus.Internal @@ -60,4 +62,11 @@ public Recipe findRecipe(long voltage, List inputs, List } return null; } + + @Override + @NotNull + public Iterator getRecipeIterator(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { + return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator(); + } }