BloodMagic/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyArray/AlchemyArrayCraftingRecipeMaker.java

40 lines
1.9 KiB
Java
Raw Normal View History

2016-03-18 04:07:49 -07:00
package WayofTime.bloodmagic.compat.jei.alchemyArray;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffectCrafting;
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
import com.google.common.collect.BiMap;
2017-08-15 21:30:48 -07:00
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
2016-03-18 04:07:49 -07:00
2017-08-15 21:30:48 -07:00
public class AlchemyArrayCraftingRecipeMaker {
2016-03-18 04:07:49 -07:00
@Nonnull
2017-08-15 21:30:48 -07:00
public static List<AlchemyArrayCraftingRecipeJEI> getRecipes() {
Map<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
2016-03-18 04:07:49 -07:00
ArrayList<AlchemyArrayCraftingRecipeJEI> recipes = new ArrayList<AlchemyArrayCraftingRecipeJEI>();
2017-08-15 21:30:48 -07:00
for (Map.Entry<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet()) {
List<ItemStack> input = itemStackAlchemyArrayRecipeEntry.getValue().getInput();
2016-03-18 04:07:49 -07:00
BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = itemStackAlchemyArrayRecipeEntry.getValue().catalystMap;
2017-08-15 21:30:48 -07:00
for (Map.Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet()) {
2016-03-18 04:07:49 -07:00
ItemStack catalyst = entry.getKey().toStack();
2017-08-15 21:30:48 -07:00
if (AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(input, catalyst) instanceof AlchemyArrayEffectCrafting) {
2017-08-15 20:21:54 -07:00
ItemStack output = ((AlchemyArrayEffectCrafting) itemStackAlchemyArrayRecipeEntry.getValue().getAlchemyArrayEffectForCatalyst(catalyst)).outputStack;
2016-03-18 04:07:49 -07:00
AlchemyArrayCraftingRecipeJEI recipe = new AlchemyArrayCraftingRecipeJEI(input, catalyst, output);
recipes.add(recipe);
}
}
}
return recipes;
}
}