Skip to content

Commit

Permalink
added iterator override to support custom recipes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wong, Dylan committed Feb 4, 2024
1 parent 89f3b5a commit 3e0b96b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -83,4 +85,11 @@ public Recipe findRecipe(long voltage, List<ItemStack> inputs, List<FluidStack>
}
return null;
}

@Override
@NotNull
public Iterator<Recipe> getRecipeIterator(long voltage, List<ItemStack> inputs, List<FluidStack> fluidInputs,
boolean exactVoltage) {
return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,4 +79,11 @@ public Recipe findRecipe(long voltage, List<ItemStack> inputs, List<FluidStack>
}
return recipe;
}

@Override
@NotNull
public Iterator<Recipe> getRecipeIterator(long voltage, List<ItemStack> inputs, List<FluidStack> fluidInputs,
boolean exactVoltage) {
return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,4 +62,11 @@ public Recipe findRecipe(long voltage, List<ItemStack> inputs, List<FluidStack>
}
return null;
}

@Override
@NotNull
public Iterator<Recipe> getRecipeIterator(long voltage, List<ItemStack> inputs, List<FluidStack> fluidInputs,
boolean exactVoltage) {
return Collections.singleton(this.findRecipe(voltage, inputs, fluidInputs, exactVoltage)).iterator();
}
}

0 comments on commit 3e0b96b

Please sign in to comment.