Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer)
- {
- if (!doTransfer)
- return null;
- Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs = recipeLayout.getItemStacks().getGuiIngredients();
- JsonRecipe recipe = new JsonRecipe(inputs.size() - 1);
- List<ItemStack> stacks = new ArrayList<ItemStack>();
- for (int i = 0; i < inputs.size(); i++)
- {
- if (!inputs.get(i).isInput())
- {
- recipe.result = OreDictHelper.getOreDictEquivalent(inputs.get(i).getAllIngredients());
- recipe.count = inputs.get(i).getAllIngredients().get(0).getCount();
- }
- }
- for (Slot slot : container.inventorySlots)
- {
- if (slot.inventory instanceof InventoryCrafting)
- {
- IGuiIngredient<ItemStack> ingredient = inputs.get(slot.getSlotIndex() + 1);
- if (ingredient != null && ingredient.getAllIngredients().size() > 0)
- {
- int x = slot.getSlotIndex() / recipe.recipeSize;
- int y = slot.getSlotIndex() % recipe.recipeSize;
- recipe.recipe[x][y] = OreDictHelper.getOreDictEquivalent(ingredient.getAllIngredients());
- stacks.add(ingredient.getAllIngredients().get(0));
- }
- else
- {
- stacks.add(null);
- }
- }
- }
- if (recipe.hasResult())
- {
- File file = new File("config/" + References.Mod.Id + "/exportRecipe.json");
- FileIOHelper.CreateFile(file);
- FileIOHelper.WriteFile(file, recipe.toJson());
- PlayerUtils.sendMessage(player, recipe.result + ": written to exportRecipe.json");
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement