Search in sources :

Example 1 with DummyRecipe

use of gregtech.api.recipes.recipes.DummyRecipe in project GregTech by GregTechCE.

the class ModHandler method removeRecipes.

public static int removeRecipes(Predicate<IRecipe> predicate) {
    int recipesRemoved = 0;
    IForgeRegistry<IRecipe> registry = ForgeRegistries.RECIPES;
    List<IRecipe> toRemove = new ArrayList<>();
    for (IRecipe recipe : registry) {
        if (predicate.test(recipe)) {
            toRemove.add(recipe);
            recipesRemoved++;
        }
    }
    toRemove.forEach(recipe -> registry.register(new DummyRecipe().setRegistryName(recipe.getRegistryName())));
    return recipesRemoved;
}
Also used : IRecipe(net.minecraft.item.crafting.IRecipe) DummyRecipe(gregtech.api.recipes.recipes.DummyRecipe)

Example 2 with DummyRecipe

use of gregtech.api.recipes.recipes.DummyRecipe in project GregTech by GregTechCEu.

the class ModHandler method removeRecipes.

public static int removeRecipes(Predicate<IRecipe> predicate) {
    int recipesRemoved = 0;
    IForgeRegistry<IRecipe> registry = ForgeRegistries.RECIPES;
    List<IRecipe> toRemove = new ArrayList<>();
    for (IRecipe recipe : registry) {
        if (predicate.test(recipe)) {
            toRemove.add(recipe);
            recipesRemoved++;
        }
    }
    toRemove.forEach(recipe -> registry.register(new DummyRecipe().setRegistryName(recipe.getRegistryName())));
    return recipesRemoved;
}
Also used : IRecipe(net.minecraft.item.crafting.IRecipe) DummyRecipe(gregtech.api.recipes.recipes.DummyRecipe)

Aggregations

DummyRecipe (gregtech.api.recipes.recipes.DummyRecipe)2 IRecipe (net.minecraft.item.crafting.IRecipe)2