package com.lothrazar.cyclic.jei;

import com.lothrazar.cyclic.ModCyclic;
import com.lothrazar.cyclic.block.melter.ContainerMelter;
import com.lothrazar.cyclic.block.melter.RecipeMelter;
import com.lothrazar.cyclic.block.melter.ScreenMelter;
import com.lothrazar.cyclic.block.solidifier.ContainerSolidifier;
import com.lothrazar.cyclic.block.solidifier.RecipeSolidifier;
import com.lothrazar.cyclic.block.solidifier.ScreenSolidifier;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.IRecipeTransferRegistration;
import net.minecraft.util.ResourceLocation;

@JeiPlugin
public class CyclicJEI implements IModPlugin {

  private ResourceLocation id = new ResourceLocation(ModCyclic.MODID, "jei");

  @Override
  public ResourceLocation getPluginUid() {
    return id;
  }

  @Override
  public void registerCategories(IRecipeCategoryRegistration registry) {
    IGuiHelper guiHelper = registry.getJeiHelpers().getGuiHelper();
    registry.addRecipeCategories(new MelterRecipeCategory(guiHelper));
    registry.addRecipeCategories(new SolidifierRecipeCategory(guiHelper));
  }

  @Override
  public void registerRecipes(IRecipeRegistration registry) {
    registry.addRecipes(RecipeMelter.RECIPES, MelterRecipeCategory.id);
    registry.addRecipes(RecipeSolidifier.RECIPES, SolidifierRecipeCategory.id);
  }

  @Override
  public void registerGuiHandlers(IGuiHandlerRegistration registry) {
    registry.addRecipeClickArea(ScreenMelter.class,
        75, 20,
        40, 26, MelterRecipeCategory.id);
    registry.addRecipeClickArea(ScreenSolidifier.class,
        75, 20,
        40, 26, SolidifierRecipeCategory.id);
  }

  @Override
  public void registerRecipeTransferHandlers(IRecipeTransferRegistration registry) {
    registry.addRecipeTransferHandler(ContainerMelter.class, MelterRecipeCategory.id,
        0, 2, //recipeSLotStart, recipeSlotCount
        2, 4 * 9);// inventorySlotStart, inventorySlotCount
    registry.addRecipeTransferHandler(ContainerSolidifier.class, SolidifierRecipeCategory.id,
        0, 3, //recipeSLotStart, recipeSlotCount
        3, 4 * 9);// inventorySlotStart, inventorySlotCount
  }
}

@@ -67,16 +67,76 @@
 Cyclic;%0A
+import com.lothrazar.cyclic.block.crafter.ContainerCrafter;%0A
 import c
@@ -483,24 +483,76 @@
 Solidifier;%0A
+import com.lothrazar.cyclic.registry.BlockRegistry;%0A
 import mezz.
@@ -626,262 +626,155 @@
 api.
-helpers.IGuiHelper;%0Aimport mezz.jei.api.registration.IGuiHandlerRegistration;%0Aimport mezz.jei.api.registration.IRecipeCategoryRegistration;%0Aimport mezz.jei.api.registration.IRecipeRegistration;%0Aimport mezz.jei.api.registration.IRecipeTransferRegistration
+constants.VanillaRecipeCategoryUid;%0Aimport mezz.jei.api.helpers.IGuiHelper;%0Aimport mezz.jei.api.registration.*;%0Aimport net.minecraft.item.ItemStack
 ;%0Aim
@@ -1325,32 +1325,252 @@
 iHelper));%0A  %7D%0A%0A
+  @Override%0A  public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) %7B%0A    registration.addRecipeCatalyst(new ItemStack(BlockRegistry.crafter.asItem(), 1), VanillaRecipeCategoryUid.CRAFTING);%0A  %7D%0A%0A
   @Override%0A  pu

Add partial JEI integration -- AutoCrafter shows up as a valid crafting option in JEI. Still need to implement the RecipeTransferHandler.