Skip to content

Commit f9a2142

Browse files
authored
Add helper for getting machine recipe process condition instances (#141)
1 parent c452f91 commit f9a2142

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package net.swedz.tesseract.neoforge.compat.mi.helper;
2+
3+
import aztech.modern_industrialization.machines.recipe.MachineRecipe;
4+
import aztech.modern_industrialization.machines.recipe.condition.MachineProcessCondition;
5+
6+
public final class MachineRecipeHelper
7+
{
8+
public static <T extends MachineProcessCondition> T getRecipeCondition(MachineRecipe recipe, Class<T> conditionType)
9+
{
10+
return recipe.conditions.stream()
11+
.filter((c) -> conditionType.isAssignableFrom(c.getClass()))
12+
.map((c) -> (T) c)
13+
.findFirst()
14+
.orElse(null);
15+
}
16+
}

0 commit comments

Comments
 (0)