/*
 * Copyright (c) 2017 3TUSK, Seraph-JACK, yesterday17, et al.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package info.tritusk.mooncakecraft;

import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.ingredients.IIngredientBlacklist;
import net.minecraft.item.ItemStack;

@JEIPlugin
public class MooncakeJEICompatibility implements IModPlugin {
    @Override
    public void register(IModRegistry registry) {
        IIngredientBlacklist blacklist = registry.getJeiHelpers().getIngredientBlacklist();
        blacklist.addIngredientToBlacklist(new ItemStack(MooncakeConstants.MOONCAKE_FILLING, 1, 0));
        blacklist.addIngredientToBlacklist(new ItemStack(MooncakeConstants.UNSHAPED_MOONCAKE_ITEM, 1, 0));
        blacklist.addIngredientToBlacklist(new ItemStack(MooncakeConstants.RAW_MOONCAKE_ITEM, 1, 0));
        blacklist.addIngredientToBlacklist(new ItemStack(MooncakeConstants.MOONCAKE_ITEM, 1, 0));
        blacklist.addIngredientToBlacklist(new ItemStack(MooncakeConstants.ICON, 1, 0));
    }
}

@@ -305,16 +305,76 @@
 craft;%0A%0A
+import info.tritusk.mooncakecraft.item.MooncakeFillingType;%0A
 import m
@@ -486,77 +486,523 @@
 api.
-ingredients.IIngredientBlacklist;%0Aimport net.minecraft.item.ItemStack
+gui.IGuiIngredientGroup;%0Aimport mezz.jei.api.gui.IRecipeLayout;%0Aimport mezz.jei.api.ingredients.IIngredientBlacklist;%0Aimport mezz.jei.api.ingredients.IIngredients;%0Aimport mezz.jei.api.recipe.IRecipeWrapper;%0Aimport mezz.jei.api.recipe.VanillaRecipeCategoryUid;%0Aimport mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;%0Aimport net.minecraft.init.Items;%0Aimport net.minecraft.item.ItemStack;%0Aimport net.minecraft.nbt.NBTTagCompound;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List
 ;%0A%0A@
@@ -1073,16 +1073,93 @@
 lugin %7B%0A
+    private static ItemStack waterBottle = new ItemStack(Items.POTIONITEM);%0A%0A
     @Ove
@@ -1798,21 +1798,1610 @@
 CON, 1, 0));
+%0A%0A        registerCustomRecipe(registry);%0A%0A        NBTTagCompound tag = new NBTTagCompound();%0A        tag.setString(%22Potion%22, %22minecraft:water%22);%0A        waterBottle.setTagCompound(tag);%0A    %7D%0A%0A    private void registerCustomRecipe(IModRegistry registry) %7B%0A        Collection%3CIRecipeWrapper%3E recipes = new ArrayList%3C%3E();%0A        for (int i = 1; i %3C MooncakeFillingType.values().length; i++) %7B%0A            recipes.add(new CustomRecipeHandler(i));%0A        %7D%0A        registry.addRecipes(recipes, VanillaRecipeCategoryUid.CRAFTING);%0A    %7D%0A%0A    private static class CustomRecipeHandler implements ICustomCraftingRecipeWrapper %7B%0A        int metadata;%0A%0A        CustomRecipeHandler(int meta) %7B%0A            metadata = meta;%0A        %7D%0A%0A        @Override%0A        public void setRecipe(IRecipeLayout recipeLayout, IIngredients ingredients) %7B%0A            recipeLayout.setShapeless();%0A            IGuiIngredientGroup%3CItemStack%3E group = recipeLayout.getIngredientsGroup(ItemStack.class);%0A            this.getIngredients(ingredients);%0A            group.set(ingredients);%0A        %7D%0A%0A        @Override%0A        public void getIngredients(IIngredients ingredients) %7B%0A            List%3CItemStack%3E inputs = new ArrayList%3C%3E();%0A            inputs.add(new ItemStack(MooncakeConstants.MOONCAKE_FILLING, 1, metadata));%0A            inputs.add(waterBottle);%0A            inputs.add(new ItemStack(MooncakeConstants.WHEAT_FLOUR));%0A            ingredients.setInputs(ItemStack.class, inputs);%0A            ingredients.setOutput(ItemStack.class, new ItemStack(MooncakeConstants.UNSHAPED_MOONCAKE_ITEM, 1, metadata));%0A        %7D
 %0A    %7D%0A%7D%0A

Improve JEI support