use of mezz.jei.ingredients.Ingredients in project CraftTweaker by CraftTweaker.
the class ConflictCommand method gatherRecipes.
/**
* Collects all recipes, converts them to the own class and adds them to the List
*/
private void gatherRecipes() {
IRecipeRegistry reg = JEIAddonPlugin.recipeRegistry;
for (IRecipeCategory category : reg.getRecipeCategories()) {
if (category instanceof CraftingRecipeCategory) {
List wrappers = reg.getRecipeWrappers(category);
for (Object wrapper : wrappers) {
if (wrapper instanceof IRecipeWrapper && !(wrapper instanceof TippedArrowRecipeWrapper)) {
IRecipeWrapper wrap = ((IRecipeWrapper) wrapper);
IIngredients ing = new Ingredients();
wrap.getIngredients(ing);
List<List<ItemStack>> inputs = ing.getInputs(ItemStack.class);
List<List<ItemStack>> outputs = ing.getOutputs(ItemStack.class);
// checks for having no outputs or having a "null" output
ItemStack output = outputs.size() > 0 ? outputs.get(0) != null ? outputs.get(0).size() > 0 ? outputs.get(0).get(0) : null : null : null;
// prevent checking recipes with "null" output
if (output == null) {
continue;
}
// differs shaped an shapeless recipes
if (wrapper instanceof IShapedCraftingRecipeWrapper) {
craftingRecipeEntries.add(new CraftingRecipeEntry(inputs, output, ((IShapedCraftingRecipeWrapper) wrapper).getWidth(), ((IShapedCraftingRecipeWrapper) wrapper).getHeight(), "noname"));
} else {
craftingRecipeEntries.add(new CraftingRecipeEntry(inputs, output, "noname"));
}
}
}
}
}
}
Aggregations