Search in sources :

Example 1 with IManyToOneRecipe

use of crazypants.enderio.base.recipe.IManyToOneRecipe in project EnderIO by SleepyTrousers.

the class AlloyRecipeCategory method register.

public static void register(IModRegistry registry, IGuiHelper guiHelper) {
    registry.addRecipeCategories(new AlloyRecipeCategory(guiHelper));
    registry.handleRecipes(IRecipe.class, AlloyRecipe::new, AlloyRecipeCategory.UID);
    registry.addRecipeClickArea(GuiAlloySmelter.class, 155, 42, 16, 16, AlloyRecipeCategory.UID);
    registry.addRecipeCategoryCraftingItem(new ItemStack(block_alloy_smelter.getBlockNN()), AlloyRecipeCategory.UID, VanillaRecipeCategoryUid.SMELTING);
    registry.addRecipeCategoryCraftingItem(new ItemStack(block_simple_alloy_smelter.getBlockNN()), AlloyRecipeCategory.UID);
    long start = System.nanoTime();
    List<IRecipe> result = new ArrayList<IRecipe>();
    for (IManyToOneRecipe rec : AlloyRecipeManager.getInstance().getRecipes()) {
        if (!rec.isSynthetic()) {
            result.add(rec);
        }
    }
    result.addAll(AlloyRecipeManager.getInstance().getVanillaRecipe().getAllRecipes());
    long end = System.nanoTime();
    registry.addRecipes(result, UID);
    registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Normal.class, AlloyRecipeCategory.UID, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT, NUM_INVENTORY_SLOT);
    registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Simple.class, AlloyRecipeCategory.UID, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT - 1, NUM_INVENTORY_SLOT);
    registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Normal.class, VanillaRecipeCategoryUid.SMELTING, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT, NUM_INVENTORY_SLOT);
    Log.info(String.format("AlloyRecipeCategory: Added %d alloy smelter recipes to JEI in %.3f seconds.", result.size(), (end - start) / 1000000000d));
}
Also used : IRecipe(crazypants.enderio.base.recipe.IRecipe) IManyToOneRecipe(crazypants.enderio.base.recipe.IManyToOneRecipe) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) ContainerAlloySmelter(crazypants.enderio.machines.machine.alloy.ContainerAlloySmelter)

Aggregations

IManyToOneRecipe (crazypants.enderio.base.recipe.IManyToOneRecipe)1 IRecipe (crazypants.enderio.base.recipe.IRecipe)1 ContainerAlloySmelter (crazypants.enderio.machines.machine.alloy.ContainerAlloySmelter)1 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1