codechicken.nei.NEIServerUtils Java Examples
The following examples show how to use
codechicken.nei.NEIServerUtils.
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: RecipeHandlerBase.java From NEI-Integration with MIT License | 6 votes |
public void setIngredientPermutationNBT(Collection<PositionedStack> ingredients, ItemStack ingredient) { for (PositionedStack stack : ingredients) { for (int i = 0; i < stack.items.length; i++) { if (NEIServerUtils.areStacksSameType(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 #5
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 #6
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 #7
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public void loadCraftingRecipes(ItemStack result) { Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.instance().getSmeltingList(); for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); }
Example #8
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 #9
Source File: ConfigSet.java From NotEnoughItems with MIT License | 5 votes |
public void loadNBT() { nbt = new NBTTagCompound(); try { if (!nbtFile.getParentFile().exists()) nbtFile.getParentFile().mkdirs(); if (!nbtFile.exists()) nbtFile.createNewFile(); if (nbtFile.length() > 0) nbt = NEIServerUtils.readNBT(nbtFile); } catch (Exception e) { e.printStackTrace(); } }
Example #10
Source File: ConfigSet.java From NotEnoughItems with MIT License | 5 votes |
public void saveNBT() { try { NEIServerUtils.writeNBT(nbt, nbtFile); } catch (Exception e) { e.printStackTrace(); } }
Example #11
Source File: RecipeHandlerCokeOven.java From NEI-Integration with MIT License | 5 votes |
@Override public void loadCraftingRecipes(ItemStack result) { super.loadCraftingRecipes(result); for (ICokeOvenRecipe recipe : RailcraftCraftingManager.cokeOven.getRecipes()) { if (recipe == null) { continue; } if (NEIServerUtils.areStacksSameType(result, recipe.getOutput())) { this.arecipes.add(new CachedCokeOvenRecipe(recipe)); } } }
Example #12
Source File: RecipeHandlerBlastFurnace.java From NEI-Integration with MIT License | 5 votes |
@Override public void loadCraftingRecipes(ItemStack result) { for (IBlastFurnaceRecipe recipe : RailcraftCraftingManager.blastFurnace.getRecipes()) { if (recipe == null) { continue; } if (NEIServerUtils.areStacksSameType(result, recipe.getOutput())) { this.arecipes.add(new CachedBlastFurnaceRecipe(recipe)); } } }
Example #13
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 #14
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 #15
Source File: BloomeryFurnaceRecipeHandler.java From GardenCollection with MIT License | 5 votes |
@Override public void loadCraftingRecipes (ItemStack result) { if (NEIServerUtils.areStacksSameType(new ItemStack(ModItems.wroughtIronIngot), result)) { arecipes.add(new SmeltingPair(new ItemStack(Items.iron_ingot), new ItemStack(Blocks.sand), new ItemStack(ModItems.wroughtIronIngot))); arecipes.add(new SmeltingPair(new ItemStack(Blocks.iron_ore), new ItemStack(Blocks.sand), new ItemStack(ModItems.wroughtIronIngot))); } }
Example #16
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; }