Search in sources :

Example 1 with InventoryCraftingIterator

use of pl.asie.charset.lib.recipe.InventoryCraftingIterator in project Charset by CharsetMC.

the class JEIPluginCharset method register.

@Override
public void register(@Nonnull IModRegistry registry) {
    STACKS = registry.getJeiHelpers().getStackHelper();
    GUIS = registry.getJeiHelpers().getGuiHelper();
    RECIPE_TRANSFER_HANDLERS = registry.getJeiHelpers().recipeTransferHandlerHelper();
    for (IRecipe recipe : ForgeRegistries.RECIPES) {
        if (recipe instanceof RecipeCharset) {
            InventoryCraftingIterator iterator = new InventoryCraftingIterator((RecipeCharset) recipe, false);
            while (iterator.hasNext()) {
                iterator.next();
                if (recipe.matches(iterator, null)) {
                    InventoryCraftingIterator.Container ctr = iterator.contain();
                    registry.addRecipes(Collections.singletonList(ctr), VanillaRecipeCategoryUid.CRAFTING);
                }
            }
        }
    }
    // registry.handleRecipes(RecipeCharset.class, JEIRecipeCharset::create, VanillaRecipeCategoryUid.CRAFTING);
    registry.handleRecipes(InventoryCraftingIterator.Container.class, JEIRecipeContainer::create, VanillaRecipeCategoryUid.CRAFTING);
    registry.handleRecipes(DyeableItemRecipeFactory.Recipe.class, JEIRecipeDyeableItem::create, VanillaRecipeCategoryUid.CRAFTING);
    for (IModPlugin plugin : getPlugins()) {
        plugin.register(registry);
    }
}
Also used : RecipeCharset(pl.asie.charset.lib.recipe.RecipeCharset) IRecipe(net.minecraft.item.crafting.IRecipe) InventoryCraftingIterator(pl.asie.charset.lib.recipe.InventoryCraftingIterator) DyeableItemRecipeFactory(pl.asie.charset.lib.recipe.DyeableItemRecipeFactory)

Aggregations

IRecipe (net.minecraft.item.crafting.IRecipe)1 DyeableItemRecipeFactory (pl.asie.charset.lib.recipe.DyeableItemRecipeFactory)1 InventoryCraftingIterator (pl.asie.charset.lib.recipe.InventoryCraftingIterator)1 RecipeCharset (pl.asie.charset.lib.recipe.RecipeCharset)1