Search in sources :

Example 71 with ShapedOreRecipe

use of net.minecraftforge.oredict.ShapedOreRecipe 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)

Example 72 with ShapedOreRecipe

use of net.minecraftforge.oredict.ShapedOreRecipe in project AgriCraft by AgriCraft.

the class ItemNugget method registerRecipes.

@Override
public void registerRecipes(IForgeRegistry<IRecipe> registry) {
    for (AgriNuggetType type : AgriNuggetType.values()) {
        // 1) Ore Dictionary registration.
        AgriCore.getLogger("agricraft").info("Registering in Ore Dictionary: {0}", type.nugget);
        ItemStack oneNugget = new ItemStack(this, 1, type.ordinal());
        OreDictionary.registerOre(type.nugget, oneNugget);
        // 2) Conditional recipes. Only if the ingot exists, because AgriCraft doesn't add its own.
        ItemStack ingot = OreDictHelper.getIngot(type.ingot);
        if (!ingot.isEmpty()) {
            AgriCore.getLogger("agricraft").info("Adding a recipe to convert nine {0} into one {1}", type.nugget, type.ingot);
            final ResourceLocation group = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget");
            final ResourceLocation name = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget_" + type.name().toLowerCase());
            final ShapedOreRecipe recipe = new ShapedOreRecipe(group, ingot, "nnn", "nnn", "nnn", 'n', type.nugget);
            recipe.setRegistryName(name);
            AgriCore.getLogger("agricraft").info("Registering nugget recipe: {0}!", recipe.getRegistryName());
            registry.register(recipe);
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) AgriNuggetType(com.infinityraider.agricraft.reference.AgriNuggetType) ItemStack(net.minecraft.item.ItemStack)

Example 73 with ShapedOreRecipe

use of net.minecraftforge.oredict.ShapedOreRecipe in project BetterWithAddons by DaedalusGame.

the class InteractionCondensedOutputs method addCondensingRecipe.

private void addCondensingRecipe(ForgeRegistry<IRecipe> registry, String id, ItemStack output, ItemStack material, ItemStack frame) {
    ItemStack outmaterial = material.copy();
    outmaterial.setCount(8);
    ResourceLocation compressLoc = new ResourceLocation(Reference.MOD_ID, "compress_" + id);
    registry.register(new ShapedOreRecipe(compressLoc, output, "aaa", "aba", "aaa", 'a', material, 'b', frame).setRegistryName(compressLoc));
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ShapedOreRecipe (net.minecraftforge.oredict.ShapedOreRecipe)73 ItemStack (net.minecraft.item.ItemStack)63 ShapelessOreRecipe (net.minecraftforge.oredict.ShapelessOreRecipe)19 ResourceLocation (net.minecraft.util.ResourceLocation)8 IRecipe (net.minecraft.item.crafting.IRecipe)7 ArrayList (java.util.ArrayList)6 Item (net.minecraft.item.Item)6 List (java.util.List)5 ShapedRecipes (net.minecraft.item.crafting.ShapedRecipes)5 Block (net.minecraft.block.Block)4 ShapelessRecipes (net.minecraft.item.crafting.ShapelessRecipes)3 Book (amerifrance.guideapi.api.impl.Book)2 CategoryAbstract (amerifrance.guideapi.api.impl.abstraction.CategoryAbstract)2 CategoryItemStack (amerifrance.guideapi.category.CategoryItemStack)2 EntryItemStack (amerifrance.guideapi.entry.EntryItemStack)2 PageFurnaceRecipe (amerifrance.guideapi.page.PageFurnaceRecipe)2 PageIRecipe (amerifrance.guideapi.page.PageIRecipe)2 PageText (amerifrance.guideapi.page.PageText)2 AgriNuggetType (com.infinityraider.agricraft.reference.AgriNuggetType)2 SpellRecipeItemsEvent (am2.api.events.SpellRecipeItemsEvent)1