Java Code Examples for codechicken.nei.NEIServerUtils#areStacksSameTypeCrafting()
The following examples show how to use
codechicken.nei.NEIServerUtils#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: TemplateRecipeHandler.java From NotEnoughItems with MIT License | 6 votes |
/** * Set all variable ingredients to this permutation. * * @param ingredient */ public void setIngredientPermutation(Collection<PositionedStack> ingredients, ItemStack ingredient) { for (PositionedStack stack : ingredients) { for (int i = 0; i < stack.items.length; i++) { if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, stack.items[i])) { stack.item = stack.items[i]; stack.item.setItemDamage(ingredient.getItemDamage()); if (ingredient.hasTagCompound()) { stack.item.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy()); } stack.items = new ItemStack[]{stack.item}; stack.setPermutationToRender(0); break; } } } }
Example 2
Source File: ShapelessRecipeHandler.java From NotEnoughItems with MIT License | 6 votes |
@Override public void loadCraftingRecipes(ItemStack result) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe); else if (irecipe instanceof ShapelessOreRecipe) recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); if (recipe == null) continue; arecipes.add(recipe); } } }
Example 3
Source File: ShapedRecipeHandler.java From NotEnoughItems with MIT License | 6 votes |
@Override public void loadCraftingRecipes(ItemStack result) { for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) { if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapedRecipe recipe = null; if (irecipe instanceof ShapedRecipes) recipe = new CachedShapedRecipe((ShapedRecipes) irecipe); else if (irecipe instanceof ShapedOreRecipe) recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe); if (recipe == null) continue; recipe.computeVisuals(); arecipes.add(recipe); } } }
Example 4
Source File: RecipeHandlerChisel.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
public CachedChiselRecipe(List<ItemStack> variations, ItemStack base, ItemStack focus) { PositionedStack pStack = new PositionedStack(base != null ? base : variations, 74, 4); pStack.setMaxSize(1); this.input.add(pStack); int row = 0; int col = 0; for (ItemStack v : variations) { this.outputs.add(new PositionedStack(v, 3 + 18 * col, 37 + 18 * row)); if (focus != null && NEIServerUtils.areStacksSameTypeCrafting(focus, v)) { this.focus = new Point(2 + 18 * col, 36 + 18 * row); } col++; if (col > 8) { col = 0; row++; } } }
Example 5
Source File: RecipeHandlerChisel.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
private static List<ItemStack> getVariationStacks(ICarvingGroup g) { List<ItemStack> stacks = new ArrayList<ItemStack>(); for (ICarvingVariation v : g.getVariations()) { stacks.add(CarvingUtils.getStack(v)); } String oreName = g.getOreName(); if (oreName != null) { check: for (ItemStack ore : OreDictionary.getOres(oreName)) { for (ItemStack stack : stacks) { if (NEIServerUtils.areStacksSameTypeCrafting(stack, ore)) { continue check; } } stacks.add(ore.copy()); } } return stacks; }
Example 6
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public void loadUsageRecipes(ItemStack ingredient) { Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.instance().getSmeltingList(); for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) { SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipes.add(arecipe); } }
Example 7
Source File: RecipeHandlerChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public void loadCraftingRecipes(ItemStack result) { for (String name : Carving.chisel.getSortedGroupNames()) { ICarvingGroup g = Carving.chisel.getGroup(name); List<ItemStack> variations = getVariationStacks(g); for (ItemStack stack : variations) { if (NEIServerUtils.areStacksSameTypeCrafting(stack, result)) { addCached(variations, null, result); } } } }
Example 8
Source File: RecipeHandlerChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public void loadUsageRecipes(ItemStack ingredient) { for (String name : Carving.chisel.getSortedGroupNames()) { ICarvingGroup g = Carving.chisel.getGroup(name); List<ItemStack> variations = getVariationStacks(g); for (ItemStack stack : variations) { if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) { addCached(variations, ingredient, null); } } } }
Example 9
Source File: Utils.java From NEI-Integration with MIT License | 4 votes |
public static boolean areStacksSameTypeCraftingSafe(ItemStack stack1, ItemStack stack2) { if (stack1 != null && stack2 != null) { return NEIServerUtils.areStacksSameTypeCrafting(stack1, stack2); } return false; }