Java 类net.minecraftforge.oredict.ShapedOreRecipe 实例源码

项目:customstuff4    文件:DamageableShapedOreRecipeTest.java   
@Test
public void test_useUpItem()
{
    ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
                                                           new int[] {60}, new ItemStack(Blocks.DIRT),
                                                           "A",
                                                           'A', new ItemStack(Items.WOODEN_SWORD));

    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);

    inv.setInventorySlotContents(0, new ItemStack(Items.WOODEN_SWORD));
    assertTrue(recipe.matches(inv, null));

    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(0).isEmpty());
}
项目:ExtraUtilities    文件:RecipeUnstableCrafting.java   
public RecipeUnstableCrafting(final ItemStack result, final Object... recipe) {
    super(result, recipe);
    this.checker = new ShapedOreRecipe(result, recipe);
    final Object[] input = super.getInput();
    final ArrayList<Object> ee3input = new ArrayList<Object>();
    for (final Object anInput : input) {
        boolean flag = true;
        if (anInput instanceof ArrayList) {
            final ArrayList<ItemStack> itemStacks = (ArrayList<ItemStack>)anInput;
            for (final ItemStack itemStack : itemStacks) {
                if (itemStack.getItem() == ExtraUtils.unstableIngot && itemStack.getItemDamage() == 2) {
                    itemStack.setTagCompound(RecipeUnstableCrafting.nbt);
                    ee3input.add(Items.diamond);
                    ee3input.add(Items.iron_ingot);
                    flag = false;
                    break;
                }
            }
        }
        if (flag) {
            ee3input.add(anInput);
        }
    }
    EE3Integration.addRecipe(this.getRecipeOutput().copy(), ee3input.toArray());
}
项目:ExtraUtilities    文件:EnderConstructorHandler.java   
public void loadUsageRecipes(final ItemStack ingredient) {
    for (final IRecipe irecipe : EnderConstructorRecipesHandler.recipes) {
        ShapedRecipeHandler.CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes) {
            recipe = new ShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
        }
        else if (irecipe instanceof ShapedOreRecipe) {
            recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
        }
        if (recipe != null) {
            if (!recipe.contains((Collection)recipe.ingredients, ingredient.getItem())) {
                continue;
            }
            recipe.computeVisuals();
            if (!recipe.contains((Collection)recipe.ingredients, ingredient)) {
                continue;
            }
            recipe.setIngredientPermutation((Collection)recipe.ingredients, ingredient);
            this.arecipes.add(recipe);
        }
    }
}
项目:ExtraUtilities    文件:EnderConstructorHandler.java   
public void loadCraftingRecipes(final String outputId, final Object... results) {
    if (outputId.equals(this.getOverlayIdentifier())) {
        for (final IRecipe irecipe : EnderConstructorRecipesHandler.recipes) {
            ShapedRecipeHandler.CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new ShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
            }
            else if (irecipe instanceof ShapedOreRecipe) {
                recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
            }
            if (recipe == null) {
                continue;
            }
            recipe.computeVisuals();
            this.arecipes.add(recipe);
        }
    }
    else if (outputId.equals("item")) {
        this.loadCraftingRecipes((ItemStack)results[0]);
    }
}
项目:ExtraUtilities    文件:EnderConstructorHandler.java   
public void loadCraftingRecipes(final ItemStack result) {
    for (final IRecipe irecipe : EnderConstructorRecipesHandler.recipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            ShapedRecipeHandler.CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new ShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
            }
            else if (irecipe instanceof ShapedOreRecipe) {
                recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
            }
            if (recipe == null) {
                continue;
            }
            recipe.computeVisuals();
            this.arecipes.add(recipe);
        }
    }
}
项目:ExtraUtilities    文件:ExtraUtils.java   
public static void registerRecipe(final Class<? extends IRecipe> recipe) {
    if (ExtraUtils.registeredRecipes.contains(recipe)) {
        return;
    }
    if (!recipe.getName().startsWith("com.rwtema.")) {
        return;
    }
    ExtraUtils.registeredRecipes.add(recipe);
    LogHelper.fine("Registering " + recipe.getSimpleName() + " to RecipeSorter", new Object[0]);
    if (ShapedOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:forge:shapedore");
    }
    else if (ShapelessOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
    else if (ShapedRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
    }
    else if (ShapelessRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless before:minecraft:bookcloning");
    }
    else {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes)
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        else if (irecipe instanceof ShapedOreRecipe)
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
            continue;

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
    int width;
    int height;
    try {
        width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
        height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
    } catch (Exception e) {
        NEIClientConfig.logger.error("Error loading recipe", e);
        return null;
    }

    Object[] items = recipe.getInput();
    for (Object item : items)
        if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
            return null;

    return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes)
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        else if (irecipe instanceof ShapedOreRecipe)
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
            continue;

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
    int width;
    int height;
    try {
        width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
        height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
    } catch (Exception e) {
        NEIClientConfig.logger.error("Error loading recipe", e);
        return null;
    }

    Object[] items = recipe.getInput();
    for (Object item : items)
        if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
            return null;

    return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
    int width;
    int height;
    try {
        width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
        height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
    } catch (Exception e) {
        LogHelper.errorError("Error loading recipe", e);
        return null;
    }

    Object[] items = recipe.getInput();
    for (Object item : items) {
        if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
        {
            return null;
        }
    }

    return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
项目:UncraftingTable    文件:RecipeHandlers.java   
private static void buildHandlerMap()
{
    // RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map
    HANDLERS.put(RecipesMapExtending.class, null);

    // vanilla Minecraft recipe handlers
    HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler());
    HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler());
    HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler());
    HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler());

    // Forge Ore Dictionary recipe handlers
    HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler());
    HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler());

    // cofh recipe handlers
    if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler());

    // industrialcraft 2 recipe handlers
    if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler());
    if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler());

    // tinker's construct recipe handlers
    if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler());
}
项目:UncraftingTable    文件:CommonProxy.java   
private void registerUncraftingRecipes()
{
    // damaged anvil recipes
    UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "damaged_anvil_1"), new ItemStack(Blocks.ANVIL, 1, 1), new Object[] { "B B", " I ", "I I", 'B', "blockIron", 'I', "ingotIron" }));
    UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "damaged_anvil_2"), new ItemStack(Blocks.ANVIL, 1, 2), new Object[] { "B  ", " I ", "  I", 'B', "blockIron", 'I', "ingotIron" }));

    if (!Loader.isModLoaded("craftablehorsearmour"))
    {
        // horse armor recipes
        UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "iron_horse_armor"), Items.IRON_HORSE_ARMOR, new Object[] { "  I", "IWI", "III", 'I', "ingotIron", 'W', Item.getItemFromBlock(Blocks.WOOL) }));
        UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "golden_horse_armor"), Items.GOLDEN_HORSE_ARMOR, new Object[] { "  G", "GWG", "GGG", 'G', "ingotGold", 'W', new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, 4) }));
        UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "diamond_horse_armor"), Items.DIAMOND_HORSE_ARMOR, new Object[] { "  D", "DWD", "DDD", 'D', "gemDiamond", 'W', new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, 3) }));
        // saddle recipe
        UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "saddle"), Items.SADDLE, new Object[] { "LLL", "S S", "I I", 'L', "leather", 'S', Items.STRING, 'I', "ingotIron" }));
    }
}
项目:TMT-Refraction    文件:CraftingRecipes.java   
public static void init() {
    GameRegistry.addRecipe(new RecipeScrewDriver());

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.LENS, 3), "AAA", 'A', "blockGlass"));
    GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.REFLECTIVE_ALLOY, 2), Items.IRON_INGOT, Items.GOLD_INGOT));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.ASSEMBLY_TABLE), "ABA", "A A", "AAA", 'A', "ingotIron", 'B', ModBlocks.LENS));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.MAGNIFIER), "ABA", "A A", "A A", 'A', "ingotIron", 'B', ModBlocks.LENS));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.SCREW_DRIVER), " AA", " BA", "B  ", 'A', "ingotIron", 'B', Items.STICK));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LASER_PEN), "  A", " BC", "D  ", 'A', Blocks.STONE_BUTTON, 'B', "dustRedstone", 'C', "ingotIron", 'D', "blockGlass"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.REFLECTIVE_ALLOY_BLOCK), "AAA", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.GRENADE, 3), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.TNT));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.HELMET), "AAA", "A A", "   ", 'A', ModItems.REFLECTIVE_ALLOY));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.CHESTPLATE), "A A", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LEGGINGS), "AAA", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BOOTS), "   ", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LIGHT_CARTRIDGE), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.GLASS_PANE));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.SPECTROMETER), "ABC", "DEF", "DDD", 'A', "dyeRed", 'B', "dyeGreen", 'C', "dyeBlue", 'D', "ingotIron", 'F', "paneGlass", 'E', LibOreDict.REFLECTIVE_ALLOY));
    GameRegistry.addShapelessRecipe(new ItemStack(ModItems.BOOK), ModItems.LASER_PEN, Items.BOOK);

    if (!ConfigValues.DISABLE_PHOTON_CANNON)
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.PHOTON_CANNON), " BA", "CDB", "EC ", 'A', ModBlocks.LENS, 'B', ModBlocks.MIRROR, 'C', ModItems.REFLECTIVE_ALLOY, 'D', ModBlocks.ELECTRON_EXCITER, 'E', ModBlocks.SENSOR));
}
项目:TFCTech    文件:TFCTechBCTransport.java   
public static void registerPipeRecipe(Item out, Item frame, Object sec1, Object sec2) {
    if (sec1 == null) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
                " G ", "GFG", " G ",
                'G', Blocks.glass_pane,
                'F', frame
        }));
    } else {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
                "1G2", "GFG", "2G1",
                'G', Blocks.glass_pane,
                'F', frame,
                '1', sec1,
                '2', sec2 == null ? sec1 : sec2
        }));
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
                "2G1", "GFG", "1G2",
                'G', Blocks.glass_pane,
                'F', frame,
                '1', sec1,
                '2', sec2 == null ? sec1 : sec2
        }));
    }
}
项目:Factorization    文件:StandardObjectWriters.java   
static void setup() {
    if (is_setup) return;
    is_setup = true;
    reg(ItemStack.class, new WriteItemStack());
    reg(Item.class, new WriteItem());
    reg(Block.class, new WriteBlock());
    reg(String.class, new WriteStringOreDictionary());
    reg(Number.class, new WriteObjectToString());
    reg(NBTBase.class, new WriteObjectToString());
    reg(FluidStack.class, new WriteFluidStack());
    reg(Fluid.class, new WriteFluid());
    reg(Collection.class, new WriteCollection());
    // IRecipe: "embedded IRecipe"; haven't seen it crop up tho
    reg(ShapedOreRecipe.class, new WriteShapedOreRecipe());
    reg(ShapedRecipes.class, new WriteShapedRecipe());
    reg(ShapelessOreRecipe.class, new WriteShapelessOreRecipe());
    reg(ShapelessRecipes.class, new WriteShapelessRecipe());
    reg(Map.Entry.class, new WriteEntry());

    IObjectWriter.adapter.register(new ArrayAdapter());
    IObjectWriter.adapter.setFallbackAdapter(new GenericAdapter<Object, IObjectWriter>(Object.class, new ReflectionWriter()));
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            } else if (irecipe instanceof ShapedOreRecipe) {
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            } else if (irecipe instanceof ShapedOreRecipe) {
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    }
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes) {
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        } else if (irecipe instanceof ShapedOreRecipe) {
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
        }

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) {
            continue;
        }

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:MakeClayValuableAgain    文件:ModItems.java   
void recipes() {
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(claySword),
      "c",
      "c",
      "s",
      'c', Items.CLAY_BALL,
      's', "stickWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(clayPick),
      "ccc",
      " s ",
      " s ",
      'c', Items.CLAY_BALL,
      's', "stickWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(clayAxe),
      "cc",
      "cs",
      " s",
      'c', Items.CLAY_BALL,
      's', "stickWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(clayShovel),
      "c",
      "s",
      "s",
      'c', Items.CLAY_BALL,
      's', "stickWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(clayHoe),
      "cc",
      " s",
      " s",
      'c', Items.CLAY_BALL,
      's', "stickWood"));
}
项目:ThermionicsWorld    文件:ThermionicsWorld.java   
public static void addBrickRecipes(IForgeRegistry<IRecipe> registry, BlockGemrock gem) {
    ResourceLocation group = new ResourceLocation("thermionics_world", "gemrock.chisel."+gem.getUnlocalizedName());
    ShapedOreRecipe a = new ShapedOreRecipe(group,
            new ItemStack(gem, 4, 1),
            "xx", "xx", 'x', new ItemStack(gem,1,0)
            );
    a.setRegistryName(new ResourceLocation("thermionics_world", "gemrock.chisel.intoBrick."+gem.getUnlocalizedName()));
    registry.register(a);

    registry.register(recipe("gemrock.chisel."+gem.getUnlocalizedName(),
            new ItemStack(gem, 1, 2),
            new ItemStack(gem, 1, 1)
            ));
    registry.register(recipe("gemrock.chisel."+gem.getUnlocalizedName(),
            new ItemStack(gem, 1, 3),
            new ItemStack(gem, 1, 2)
            ));
    registry.register(recipe("gemrock.chisel."+gem.getUnlocalizedName(),
            new ItemStack(gem, 1, 4),
            new ItemStack(gem, 1, 3)
            ));
    registry.register(recipe("gemrock.chisel."+gem.getUnlocalizedName(),
            new ItemStack(gem, 1, 1),
            new ItemStack(gem, 1, 4)
            ));

}
项目:pnc-repressurized    文件:CraftingRegistrator.java   
private static void scanForFluids(ShapedOreRecipe recipe) {
    for (int i = 0; i < recipe.getIngredients().size(); i++) {
        Ingredient ingredient = recipe.getIngredients().get(i);
        for (ItemStack stack : ingredient.getMatchingStacks()) {
            FluidStack fluid = FluidUtil.getFluidContained(stack);
            if (fluid != null) {
                ForgeRegistries.RECIPES.register(new RecipeFluid(recipe, i));
            }
        }
    }
}
项目:pnc-repressurized    文件:RecipeAmadronTablet.java   
RecipeAmadronTablet() {
    super("amadron_tablet_actual");

    this.primer = CraftingHelper.parseShaped("ppp", "pgp", "pcp",
            'p', new ItemStack(Itemss.PLASTIC, 1, ItemPlastic.GREY),
            'g', Itemss.GPS_TOOL,
            'c', new ItemStack(Itemss.AIR_CANISTER, 1, OreDictionary.WILDCARD_VALUE));
    this.recipe = new ShapedOreRecipe(RL("matcher_amadron_tablet"),
            new ItemStack(Itemss.AMADRON_TABLET, 1, Itemss.AMADRON_TABLET.getMaxDamage()), primer);
}
项目:pnc-repressurized    文件:RecipeGun.java   
public RecipeGun(String dyeName, Item output) {
    super(output.getRegistryName().getResourcePath() + "_actual");
    this.output = output;
    this.primer = CraftingHelper.parseShaped("idi", "c  ", "ili",
            'd', dyeName, 'i', Itemss.INGOT_IRON_COMPRESSED, 'l', Blocks.LEVER,
            'c', new ItemStack(Itemss.AIR_CANISTER, 1, OreDictionary.WILDCARD_VALUE));
    this.recipe = new ShapedOreRecipe(RL("matcher_" + output.getRegistryName().getResourcePath()), getRecipeOutput(), primer);
}
项目:pnc-repressurized    文件:RecipeFluid.java   
public RecipeFluid(ShapedOreRecipe recipe, int fluidIndex) {
    super("fluid_recipe_" + recipeIndex++);
    this.recipe = recipe;
    Ingredient ingredient = recipe.getIngredients().get(fluidIndex);
    originalStack = ingredient.getMatchingStacks()[0];
    fluidStack = FluidUtil.getFluidContained(originalStack);
    if (fluidStack == null)
        throw new IllegalArgumentException("Recipe doesn't have fluid item at index " + fluidIndex + ". Item: " + originalStack);
    this.fluidIndex = fluidIndex;
}
项目:nei-lotr    文件:ExtendedShapedRecipeHandler.java   
public CachedRecipe getCachedRecipe(IRecipe recipe) {
    CachedRecipe ret = null;
    if (recipe instanceof ShapedRecipes) {
        ret = new ExtendedCachedShapedRecipe((ShapedRecipes) recipe);
    } else if (recipe instanceof ShapedOreRecipe) {
        ret = new ExtendedCachedShapedRecipe((ShapedOreRecipe) recipe);
    }
    return ret;
}
项目:Metalworks    文件:ItemBase.java   
public void registerRecipes(final List<IRecipe> recipes){
    if(!this.recipes.isEmpty()){
        for(Object[] rec : this.recipes){
            recipes.add(new ShapedOreRecipe(null, this, rec));
        }
    }
}
项目:Metalworks    文件:ItemArmorCollection.java   
public void registerRecipes(final Map<ResourceLocation, IRecipe> recipes, Object ingotStackOrString){
    recipes.put(new ResourceLocation(Metalworks.MODID, "head_" + this.material.name()),
            new ShapedOreRecipe(null, head, "sss", "s s", 's', ingotStackOrString));
    recipes.put(new ResourceLocation(Metalworks.MODID, "chest_" + this.material.name()),
            new ShapedOreRecipe(null, chestplate, "s s", "sss", "sss", 's', ingotStackOrString));
    recipes.put(new ResourceLocation(Metalworks.MODID, "legs_" + this.material.name()),
            new ShapedOreRecipe(null, legs, "sss", "s s", "s s", 's', ingotStackOrString));
    recipes.put(new ResourceLocation(Metalworks.MODID, "feet_" + this.material.name()),
            new ShapedOreRecipe(null, shoes, "s s", "s s", 's', ingotStackOrString));
}
项目:Metalworks    文件:ItemToolCollection.java   
public void registerRecipes(final Map<ResourceLocation, IRecipe> recipes, Object ingotStackOrString){
    recipes.put(new ResourceLocation(Metalworks.MODID, "pickaxe_" + this.material.name()),
            new ShapedOreRecipe(null, pickaxe, "mmm", " s ", " s ", 'm', ingotStackOrString, 's', "stickWood"));
    recipes.put(new ResourceLocation(Metalworks.MODID, "axe_" + this.material.name()),
            new ShapedOreRecipe(null, axe, "mm", "ms", " s", 'm', ingotStackOrString, 's', "stickWood"));
    recipes.put(new ResourceLocation(Metalworks.MODID, "sword_" + this.material.name()),
            new ShapedOreRecipe(null, sword, "m", "m", "s", 'm', ingotStackOrString, 's', "stickWood"));
    recipes.put(new ResourceLocation(Metalworks.MODID, "shovel_" + this.material.name()),
            new ShapedOreRecipe(null, shovel, "m", "s", "s", 'm', ingotStackOrString, 's', "stickWood"));
}
项目:Metalworks    文件:BlockBase.java   
public void registerRecipes(final List<IRecipe> recipes){
    if(!this.recipes.isEmpty()){
        for(Object[] rec : this.recipes){
            recipes.add(new ShapedOreRecipe(null, this, rec));
        }
    }
}
项目:MeeCreeps    文件:InsertCartridgeFactory.java   
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
    ShapedOreRecipe recipe = ShapedOreRecipe.factory(context, json);

    ShapedPrimer primer = new ShapedPrimer();
    primer.width = recipe.getWidth();
    primer.height = recipe.getHeight();
    primer.mirrored = JsonUtils.getBoolean(json, "mirrored", true);
    primer.input = recipe.getIngredients();

    return new InsertCartridgeRecipe(new ResourceLocation(MeeCreeps.MODID, "insert_cartridge_factory"), recipe.getRecipeOutput(), primer);
}
项目:MeeCreeps    文件:RemoveCartridgeFactory.java   
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
    ShapedOreRecipe recipe = ShapedOreRecipe.factory(context, json);

    ShapedPrimer primer = new ShapedPrimer();
    primer.width = recipe.getWidth();
    primer.height = recipe.getHeight();
    primer.mirrored = JsonUtils.getBoolean(json, "mirrored", true);
    primer.input = recipe.getIngredients();

    return new RemoveCartridgeRecipe(new ResourceLocation(MeeCreeps.MODID, "remove_cartridge_factory"), recipe.getRecipeOutput(), primer);
}
项目:Wopper    文件:Wopper.java   
@EventHandler
public void init(FMLInitializationEvent event){
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWopper),
            "W W", "WCW", " W ",
            'W', "plankWood",
            'C', "chestWood"));
}
项目:Polearms    文件:CommonProxy.java   
private void registerCrafting() {
    GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.pole, "#", "#", '#', Items.STICK));
    GameRegistry.addShapedRecipe(ModItems.woodSpear, 
            "#",
            "$",
            "$",
            '#', new ItemStack(Items.WOODEN_SWORD),
            '$', ModItems.pole);
    GameRegistry.addShapedRecipe(ModItems.stoneSpear, 
            "#",
            "$",
            "$",
            '#', new ItemStack(Items.STONE_SWORD),
            '$', ModItems.pole);
    GameRegistry.addShapedRecipe(ModItems.ironSpear, 
            "#",
            "$",
            "$",
            '#', new ItemStack(Items.IRON_SWORD),
            '$', ModItems.pole);
    GameRegistry.addShapedRecipe(ModItems.goldSpear, 
            "#",
            "$",
            "$",
            '#', new ItemStack(Items.GOLDEN_SWORD),
            '$', ModItems.pole);
    GameRegistry.addShapedRecipe(ModItems.diamondSpear, 
            "#",
            "$",
            "$",
            '#', new ItemStack(Items.DIAMOND_SWORD),
            '$', ModItems.pole);
}
项目:customstuff4    文件:ShapedRecipe.java   
private boolean matchesInput(IRecipe recipe)
{
    if (recipe instanceof ShapedRecipes)
    {
        return matchesInput((ShapedRecipes) recipe);
    } else if (recipe instanceof ShapedOreRecipe)
    {
        return matchesInput((ShapedOreRecipe) recipe);
    }

    return false;
}
项目:customstuff4    文件:ShapedRecipe.java   
private boolean matchesInput(ShapedOreRecipe recipe)
{
    if (recipe.getWidth() != getRecipeWidth())
        return false;
    if (recipe.getHeight() != getRecipeHeight())
        return false;

    return isSameInputs(recipe.getIngredients());
}