Java Code Examples for codechicken.nei.NEIClientUtils#areStacksSameTypeCrafting()

The following examples show how to use codechicken.nei.NEIClientUtils#areStacksSameTypeCrafting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NEIAssemblyControllerRecipeManager.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void loadUsageRecipes(ItemStack ingredient){
    for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
        AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
        boolean[] addedRecipe = new boolean[program.getRecipeList().size()];
        for(int j = 0; j < program.getRecipeList().size(); j++) {
            if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getInput(), ingredient)) {
                arecipes.add(getShape(i, j));
                addedRecipe[j] = true;
            }
        }
        if(ingredient.getItem() == Itemss.assemblyProgram && ingredient.getItemDamage() == i) {
            for(int j = 0; j < program.getRecipeList().size(); j++)
                if(!addedRecipe[j]) arecipes.add(getShape(i, j));
        } else {
            for(ItemStack machine : getMachinesFromEnum(program.getRequiredMachines())) {
                if(NEIClientUtils.areStacksSameTypeCrafting(machine, ingredient)) {
                    for(int j = 0; j < program.getRecipeList().size(); j++)
                        if(!addedRecipe[j]) arecipes.add(getShape(i, j));
                    break;
                }
            }
        }
    }
}
 
Example 2
Source File: NEIAssemblyControllerRecipeManager.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void loadCraftingRecipes(ItemStack result){
    for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
        AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
        for(int j = 0; j < program.getRecipeList().size(); j++) {
            if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getOutput(), result)) {
                arecipes.add(getShape(i, j));
                break;
            }
        }
    }
}
 
Example 3
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void loadCraftingRecipes(ItemStack output){
    for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
        for(PositionedStack stack : recipe.output) {
            for(ItemStack itemStack : stack.items) {
                if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, output)) {
                    arecipes.add(recipe);
                }
            }
        }
    }
}
 
Example 4
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Simplified wrapper, implement this and fill the empty recipe array with recipes
 *
 * @param ingredient The ingredient the recipes must contain.
 */
@Override
public void loadUsageRecipes(ItemStack ingredient){
    for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
        for(PositionedStack stack : recipe.input) {
            for(ItemStack itemStack : stack.items) {
                if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, ingredient)) {
                    arecipes.add(recipe);
                }
            }
        }
    }
}