Search in sources :

Example 1 with InvalidRecipeException

use of mods.railcraft.common.util.crafting.InvalidRecipeException in project Railcraft by Railcraft.

the class CraftingPlugin method addShapelessRecipe.

public static void addShapelessRecipe(@Nullable ItemStack result, Object... recipeArray) {
    ProcessedRecipe processedRecipe;
    try {
        processedRecipe = processRecipe(RecipeType.SHAPELESS, result, recipeArray);
    } catch (InvalidRecipeException ex) {
        Game.logTrace(Level.WARN, ex.getRawMessage());
        return;
    }
    if (processedRecipe.isOreRecipe) {
        IRecipe recipe = new ShapelessOreRecipe(processedRecipe.result, processedRecipe.recipeArray);
        addRecipe(recipe);
    } else
        GameRegistry.addShapelessRecipe(processedRecipe.result, processedRecipe.recipeArray);
}
Also used : IRecipe(net.minecraft.item.crafting.IRecipe) ShapelessOreRecipe(net.minecraftforge.oredict.ShapelessOreRecipe) InvalidRecipeException(mods.railcraft.common.util.crafting.InvalidRecipeException)

Example 2 with InvalidRecipeException

use of mods.railcraft.common.util.crafting.InvalidRecipeException in project Railcraft by Railcraft.

the class CraftingPlugin method addRecipe.

public static void addRecipe(@Nullable ItemStack result, Object... recipeArray) {
    ProcessedRecipe processedRecipe;
    try {
        processedRecipe = processRecipe(RecipeType.SHAPED, result, recipeArray);
    } catch (InvalidRecipeException ex) {
        Game.logTrace(Level.WARN, ex.getRawMessage());
        return;
    }
    if (processedRecipe.isOreRecipe) {
        IRecipe recipe = new ShapedOreRecipe(processedRecipe.result, processedRecipe.recipeArray);
        addRecipe(recipe);
    } else
        GameRegistry.addRecipe(processedRecipe.result, processedRecipe.recipeArray);
}
Also used : IRecipe(net.minecraft.item.crafting.IRecipe) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) InvalidRecipeException(mods.railcraft.common.util.crafting.InvalidRecipeException)

Aggregations

InvalidRecipeException (mods.railcraft.common.util.crafting.InvalidRecipeException)2 IRecipe (net.minecraft.item.crafting.IRecipe)2 ShapedOreRecipe (net.minecraftforge.oredict.ShapedOreRecipe)1 ShapelessOreRecipe (net.minecraftforge.oredict.ShapelessOreRecipe)1