net.minecraft.util.WeightedRandomChestContent#net.minecraftforge.oredict.ShapelessOreRecipe源码实例Demo

下面列出了net.minecraft.util.WeightedRandomChestContent#net.minecraftforge.oredict.ShapelessOreRecipe 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GregTech   文件: MetaItemShapelessRecipeFactory.java
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
    String group = JsonUtils.getString(json, "group", "");

    NonNullList<Ingredient> ings = NonNullList.create();
    for (JsonElement ele : JsonUtils.getJsonArray(json, "ingredients"))
        ings.add(CraftingHelper.getIngredient(ele, context));

    if (ings.isEmpty())
        throw new JsonParseException("No ingredients for shapeless recipe");

    JsonObject result = JsonUtils.getJsonObject(json, "result");
    String name = JsonUtils.getString(result, "name");
    int amount = JsonUtils.getInt(result, "amount", 1);
    ItemStack stack = ItemStack.EMPTY;
    for (MetaItem<?> item : MetaItems.ITEMS) {
        MetaItem<?>.MetaValueItem value = item.getItem(name);
        if (value != null) {
            stack = value.getStackForm(amount);
        }
    }
    return new ShapelessOreRecipe(group.isEmpty() ? null : new ResourceLocation(group), ings, stack);
}
 
源代码2 项目: customstuff4   文件: ShapelessRecipe.java
private boolean matchesInput(ShapelessOreRecipe recipe)
{
    if (recipe.getIngredients().size() != getRecipeSize())
        return false;

    Object[] input = getRecipeInput();

    for (int i = 0; i < recipe.getIngredients().size(); i++)
    {
        Ingredient target = recipe.getIngredients().get(i);
        Object source = input[i];

        if (!ItemHelper.isSameRecipeInput(target, source))
            return false;
    }
    return true;
}
 
源代码3 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
        for (IRecipe irecipe : allrecipes) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes) {
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            } else if (irecipe instanceof ShapelessOreRecipe) {
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
 
源代码4 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes) {
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            } else if (irecipe instanceof ShapelessOreRecipe) {
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            arecipes.add(recipe);
        }
    }
}
 
源代码5 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes) {
            recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        } else if (irecipe instanceof ShapelessOreRecipe) {
            recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
        }

        if (recipe == null) {
            continue;
        }

        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
 
源代码6 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
        for (IRecipe irecipe : allrecipes) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
 
源代码7 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    }
}
 
源代码8 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes)
            recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        else if (irecipe instanceof ShapelessOreRecipe)
            recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

        if (recipe == null)
            continue;

        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
 
源代码9 项目: customstuff4   文件: ShapelessRecipe.java
private boolean matchesInput(IRecipe recipe)
{
    if (recipe instanceof ShapelessRecipes)
    {
        return matchesInput((ShapelessRecipes) recipe);
    } else if (recipe instanceof ShapelessOreRecipe)
    {
        return matchesInput((ShapelessOreRecipe) recipe);
    }

    return false;
}
 
源代码10 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
public CachedShapelessRecipe forgeShapelessRecipe(ShapelessOreRecipe recipe) {
    List<Object> items = recipe.getInput();

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

    return new CachedShapelessRecipe(items, recipe.getRecipeOutput());
}
 
源代码11 项目: BaseMetals   文件: Recipes.java
private static void initVanillaRecipes(){
	OreDictionary.registerOre("barsIron", Blocks.IRON_BARS);
	OreDictionary.registerOre("bars", Blocks.IRON_BARS);
	OreDictionary.registerOre("doorIron", Items.IRON_DOOR);
	OreDictionary.registerOre("door", Items.IRON_DOOR);
	OreDictionary.registerOre("doorWood", Items.OAK_DOOR);
	OreDictionary.registerOre("doorWood", Items.JUNGLE_DOOR);
	OreDictionary.registerOre("doorWood", Items.SPRUCE_DOOR);
	OreDictionary.registerOre("doorWood", Items.DARK_OAK_DOOR);
	OreDictionary.registerOre("doorWood", Items.BIRCH_DOOR);
	OreDictionary.registerOre("doorWood", Items.ACACIA_DOOR);
	OreDictionary.registerOre("door", Items.OAK_DOOR);
	OreDictionary.registerOre("door", Items.JUNGLE_DOOR);
	OreDictionary.registerOre("door", Items.SPRUCE_DOOR);
	OreDictionary.registerOre("door", Items.DARK_OAK_DOOR);
	OreDictionary.registerOre("door", Items.BIRCH_DOOR);
	OreDictionary.registerOre("door", Items.ACACIA_DOOR);
	
	CrusherRecipeRegistry.addNewCrusherRecipe("oreIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe("ingotIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,1));
	CrusherRecipeRegistry.addNewCrusherRecipe("oreGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe("ingotGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,1));
	GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(cyano.basemetals.init.Items.iron_nugget,9), new ItemStack(Items.IRON_INGOT)));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.IRON_INGOT), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.iron_nugget));
	GameRegistry.addSmelting(cyano.basemetals.init.Items.iron_powder, new ItemStack(Items.IRON_INGOT), 0f);
	GameRegistry.addSmelting(cyano.basemetals.init.Items.gold_powder, new ItemStack(Items.GOLD_INGOT), 0f);
	CrusherRecipeRegistry.addNewCrusherRecipe("oreCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,0), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
	CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,1), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.COAL_BLOCK), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.carbon_powder));
}
 
源代码12 项目: NotEnoughItems   文件: ShapelessRecipeHandler.java
public CachedShapelessRecipe forgeShapelessRecipe(ShapelessOreRecipe recipe) {
    ArrayList<Object> items = recipe.getInput();

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

    return new CachedShapelessRecipe(items, recipe.getRecipeOutput());
}
 
private CachedRollingMachineShapelessRecipe getCachedRecipe(IRecipe irecipe, boolean genPerms) {
    CachedRollingMachineShapelessRecipe recipe = null;
    if (irecipe instanceof ShapelessRecipes) {
        recipe = new CachedRollingMachineShapelessRecipe(((ShapelessRecipes) irecipe).recipeItems, ((ShapelessRecipes) irecipe).getRecipeOutput());
    } else if (irecipe instanceof ShapelessOreRecipe) {
        recipe = this.getCachedOreRecipe((ShapelessOreRecipe) irecipe, genPerms);
    }
    return recipe;
}
 
private CachedRollingMachineShapelessRecipe getCachedOreRecipe(ShapelessOreRecipe recipe, boolean genPerms) {
    ArrayList<Object> items = recipe.getInput();
    for (Object item : items) {
        if (item instanceof List && ((List<?>) item).isEmpty()) {
            return null;
        }
    }
    return new CachedRollingMachineShapelessRecipe(items, recipe.getRecipeOutput(), genPerms);
}
 
源代码15 项目: PneumaticCraft   文件: ClientProxy.java
@Override
public void init(){
    for(int i = 0; i < 16; i++) { //Only register these recipes client side, so NEI compatibility works, but drones don't lose their program when dyed.
        ItemStack drone = new ItemStack(Itemss.drone);
        NBTTagCompound tag = new NBTTagCompound();
        tag.setInteger("color", ItemDye.field_150922_c[i]);
        drone.setTagCompound(tag);
        GameRegistry.addRecipe(new ShapelessOreRecipe(drone, Itemss.drone, TileEntityPlasticMixer.DYES[i]));
    }
    CraftingRegistrator.addShapelessRecipe(new ItemStack(Itemss.drone), new ItemStack(Itemss.logisticsDrone), Itemss.printedCircuitBoard);

    ThirdPartyManager.instance().clientInit();
}
 
源代码16 项目: OpenPeripheral-Addons   文件: Recipes.java
public static void register() {
	final ItemStack duckAntenna = MetasGeneric.duckAntenna.newItemStack();

	@SuppressWarnings("unchecked")
	final List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();

	if (OpenPeripheralAddons.Blocks.pim != null) {
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Blocks.pim, "ooo", "rcr", 'o', Blocks.obsidian, 'r', Items.redstone, 'c', Blocks.chest));
	}

	if (OpenPeripheralAddons.Blocks.sensor != null) {
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Blocks.sensor, "ooo", " w ", "sss", 'o', Blocks.obsidian, 'w', "stickWood", 's', Blocks.stone_slab));
	}

	if (OpenPeripheralAddons.Blocks.glassesBridge != null) {
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Blocks.glassesBridge, "sas", "ses", "srs", 's', Blocks.stone, 'r', Blocks.redstone_block, 'e', Items.ender_pearl, 'a', duckAntenna.copy()));
	}

	if (OpenPeripheralAddons.Blocks.selector != null) {
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Blocks.selector, "sss", "scs", "sgs", 's', Blocks.stone, 'c', Blocks.trapped_chest, 'g', Blocks.glass_pane));
	}

	if (OpenPeripheralAddons.Items.glasses != null) {
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Items.glasses, "igi", "aei", "prp", 'g', Blocks.glowstone, 'i', Items.iron_ingot, 'e', Items.ender_pearl, 'p', Blocks.glass_pane, 'r', Items.redstone, 'a', duckAntenna.copy()));
		recipeList.add(new ShapedOreRecipe(OpenPeripheralAddons.Items.glasses, "igi", "iea", "prp", 'g', Blocks.glowstone, 'i', Items.iron_ingot, 'e', Items.ender_pearl, 'p', Blocks.glass_pane, 'r', Items.redstone, 'a', duckAntenna.copy()));

		recipeList.add(new TerminalAddonRecipe());
		RecipeSorter.register("openperipheraladdons:terminal", TerminalAddonRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
	}

	if (OpenPeripheralAddons.Items.keyboard != null) {
		recipeList.add(new ShapelessOreRecipe(OpenPeripheralAddons.Items.keyboard, duckAntenna.copy(), Items.bone, Items.redstone, Items.ender_pearl, Items.slime_ball));
	}

	if (Loader.isModLoaded(Mods.COMPUTERCRAFT)) ModuleComputerCraft.registerRecipes(recipeList);
	if (Loader.isModLoaded(Mods.RAILCRAFT)) ModuleRailcraft.registerRecipes(recipeList);

}
 
源代码17 项目: GregTech   文件: ModHandler.java
/**
 * Add Shapeless Crafting Recipes
 */
public static void addShapelessRecipe(String regName, ItemStack result, Object... recipe) {
    boolean skip = false;
    if (result.isEmpty()) {
        GTLog.logger.error("Result cannot be an empty ItemStack. Recipe: {}", regName);
        GTLog.logger.error("Stacktrace:", new IllegalArgumentException());
        skip = true;
    }
    skip |= validateRecipe(regName, recipe);
    if (skip) {
        RecipeMap.setFoundInvalidRecipe(true);
        return;
    }

    for (byte i = 0; i < recipe.length; i++) {
        if (recipe[i] instanceof MetaItem.MetaValueItem) {
            recipe[i] = ((MetaItem<?>.MetaValueItem) recipe[i]).getStackForm();
        } else if (recipe[i] instanceof Enum) {
            recipe[i] = ((Enum<?>) recipe[i]).name();
        } else if (recipe[i] instanceof UnificationEntry) {
            recipe[i] = recipe[i].toString();
        } else if (recipe[i] instanceof Character) {
            String toolName = getToolNameByCharacter((char) recipe[i]);
            if (toolName == null) {
                throw new IllegalArgumentException("Tool name is not found for char " + recipe[i]);
            }
            recipe[i] = toolName;
        } else if (!(recipe[i] instanceof ItemStack
            || recipe[i] instanceof Item
            || recipe[i] instanceof Block
            || recipe[i] instanceof String)) {
            throw new IllegalArgumentException(recipe.getClass().getSimpleName() + " type is not suitable for crafting input.");
        }
    }

    IRecipe shapelessRecipe = new ShapelessOreRecipe(null, result.copy(), recipe)
        .setRegistryName(regName);

    try {
        //workaround for MC bug that makes all shaped recipe inputs that have enchanted items
        //or renamed ones on input fail, even if all ingredients match it
        Field field = ShapelessOreRecipe.class.getDeclaredField("isSimple");
        field.setAccessible(true);
        field.setBoolean(shapelessRecipe, false);
    } catch (ReflectiveOperationException exception) {
        GTLog.logger.error("Failed to mark shapeless recipe as complex", exception);
    }

    ForgeRegistries.RECIPES.register(shapelessRecipe);
}
 
源代码18 项目: customstuff4   文件: ShapelessRecipeTests.java
private List<IRecipe> createTestRecipesOre(Item result)
{
    return Lists.newArrayList(new ShapelessOreRecipe(new ResourceLocation("group"), new ItemStack(result), new ItemStack(Items.ITEM_FRAME)),
                              new ShapelessOreRecipe(new ResourceLocation("group"), new ItemStack(result), new ItemStack(Blocks.STONE), "stickWood"));
}
 
源代码19 项目: Et-Futurum   文件: ModRecipes.java
private static void addShapelessRecipe(ItemStack output, Object... objects) {
	GameRegistry.addRecipe(new ShapelessOreRecipe(output, objects));
}
 
源代码20 项目: GardenCollection   文件: ModRecipes.java
public void init () {
    GameRegistry.addRecipe(new ItemStack(ModBlocks.largePot, 3, 1), "x x", "x x", "xxx",
        'x', Blocks.clay);
    GameRegistry.addRecipe(new ItemStack(ModBlocks.largePot, 3), "x x", "x x", "xxx",
        'x', Blocks.hardened_clay);

    for (int i = 0; i < 16; i++) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.largePotColored, 3, i), "x x", "x x", "xxx",
            'x', new ItemStack(Blocks.stained_hardened_clay, 1, 15 - i));

        GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.largePotColored, 1, i),
            ModBlocks.largePot, dyeOreDict[i]));
    }

    GameRegistry.addRecipe(new ItemStack(ModBlocks.mediumPot, 3), "x x", "x x", " x ",
        'x', Blocks.hardened_clay);

    for (int i = 0; i < 16; i++) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.mediumPotColored, 3, i), "x x", "x x", " x ",
            'x', new ItemStack(Blocks.stained_hardened_clay, 1, 15 - i));

        GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.mediumPotColored, 1, i),
            ModBlocks.mediumPot, dyeOreDict[i]));
    }

    GameRegistry.addRecipe(new ItemStack(ModBlocks.potteryTable), "x", "y",
        'x', Items.clay_ball, 'y', Blocks.crafting_table);

    GameRegistry.addSmelting(new ItemStack(ModBlocks.largePot, 1, 1), new ItemStack(ModBlocks.largePot, 1, 0), 0);

    for (int i = 1; i < 256; i++) {
        if (GardenContainers.config.hasPattern(i))
            GameRegistry.addSmelting(new ItemStack(ModBlocks.largePot, 1, 1 | (i << 8)), new ItemStack(ModBlocks.largePot, 1, (i << 8)), 0);
    }

    for (int i = 0; i < 6; i++) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.decorativePot, 3, i), "x x", "xxx", " x ",
            'x', new ItemStack(Blocks.quartz_block, 1, i));
    }

    for (int i = 0; i < 6; i++) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.woodWindowBox, 1, i), "yxy",
            'x', Items.flower_pot, 'y', new ItemStack(Blocks.planks, 1, i));
    }
    for (int i = 0; i < ModBlocks.stoneWindowBox.getSubTypes().length; i++) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.stoneWindowBox, 1, i), "yxy",
            'x', Items.flower_pot, 'y', new ItemStack(ModBlocks.stoneWindowBox.getBlockFromMeta(i), 1, ModBlocks.stoneWindowBox.getMetaFromMeta(i)));
    }

    // Smelting

    GameRegistry.addSmelting(new ItemStack(ModBlocks.largePot, 1, 1), new ItemStack(ModBlocks.largePot, 1, 0), 0);

    for (int i = 1; i < 256; i++) {
        if (GardenContainers.config.hasPattern(i))
            GameRegistry.addSmelting(new ItemStack(ModBlocks.largePot, 1, 1 | (i << 8)), new ItemStack(ModBlocks.largePot, 1, (i << 8)), 0);
    }
}
 
源代码21 项目: GardenCollection   文件: ModRecipes.java
public void init () {
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 0), "xx ", "x x", " xx", 'x', "nuggetIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 1), "xx ", "x x", " xx", 'x', "nuggetGold"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 1), "xx ", "x x", " xx", 'x', "nuggetBrass"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 2), "xx ", "x x", " xx", 'x', "nuggetWroughtIron"));

    ItemStack linkIron = new ItemStack(ModItems.chainLink, 1, 0);
    ItemStack linkGold = new ItemStack(ModItems.chainLink, 1, 1);
    ItemStack linkWroughtIron = new ItemStack(ModItems.chainLink, 1, 2);
    ItemStack ironNugget = new ItemStack(ModItems.ironNugget);
    ItemStack heavyChainIron = new ItemStack(ModBlocks.heavyChain);
    ItemStack lightChainIron = new ItemStack(ModBlocks.lightChain);
    ItemStack latticeIron = new ItemStack(ModBlocks.latticeMetal);
    ItemStack vine = new ItemStack(Blocks.vine);
    ItemStack blockWroughtIron = new ItemStack(ModBlocks.metalBlock);
    ItemStack wroughtIronIngot = new ItemStack(ModItems.wroughtIronIngot);
    ItemStack wroughtIronNugget = new ItemStack(ModItems.wroughtIronNugget);
    ItemStack blockCharcoal = new ItemStack(ModBlocks.stoneBlock);

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 0), "xx", "xx", "xx", 'x', linkIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 1), "xx", "xx", "xx", 'x', linkGold);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 4), "xx", "xx", "xx", 'x', linkWroughtIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 8, 5), "xxx", "xyx", "xxx", 'x', heavyChainIron, 'y', vine);

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 0), "x", "x", "x", 'x', linkIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 1), "x", "x", "x", 'x', linkGold);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 4), "x", "x", "x", 'x', linkWroughtIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 8, 5), "xxx", "xyx", "xxx", 'x', lightChainIron, 'y', vine);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.latticeMetal, 16, 0), " x ", "xxx", " x ", 'x', "ingotIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.latticeMetal, 16, 2), " x ", "xxx", " x ", 'x', "ingotWroughtIron"));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.latticeMetal, 8, 3), "xxx", "xyx", "xxx", 'x', latticeIron, 'y', vine);

    GameRegistry.addShapedRecipe(new ItemStack(Items.iron_ingot), "xxx", "xxx", "xxx", 'x', ironNugget);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironNugget, 9), "x", 'x', new ItemStack(Items.iron_ingot));

    GameRegistry.addShapedRecipe(blockCharcoal, "xxx", "xxx", "xxx", 'x', new ItemStack(Items.coal, 1, 1));
    GameRegistry.addShapedRecipe(new ItemStack(Items.coal, 9, 1), "x", 'x', blockCharcoal);

    GameRegistry.addShapedRecipe(blockWroughtIron, "xxx", "xxx", "xxx", 'x', wroughtIronIngot);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.wroughtIronIngot, 9), "x", 'x', blockWroughtIron);
    GameRegistry.addShapedRecipe(wroughtIronIngot, "xxx", "xxx", "xxx", 'x', wroughtIronNugget);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.wroughtIronNugget, 9), "x", 'x', wroughtIronIngot);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fence, 16, 0), "xxx", "xxx", 'x', "ingotWroughtIron"));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 1), "x", 'x', new ItemStack(ModBlocks.fence, 1, 0));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 2), "x", 'x', new ItemStack(ModBlocks.fence, 1, 1));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 3), "x", 'x', new ItemStack(ModBlocks.fence, 1, 2));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 0), "x", 'x', new ItemStack(ModBlocks.fence, 1, 3));

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.bloomeryFurnace), "xxx", "xyx", "xxx",
        'x', Items.brick, 'y', new ItemStack(Blocks.furnace));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.lantern, 4, 0), " x ", "y y", "yxy",
        'x', "ingotWroughtIron", 'y', new ItemStack(ModBlocks.fence, 1, 0)));
    for (int i = 0; i < 16; i++) {
        ItemStack target = ((ItemLantern)Item.getItemFromBlock(ModBlocks.lantern)).makeItemStack(4, i, true);
        GameRegistry.addRecipe(new ShapedOreRecipe(target, " x ", "yzy", "yxy",
            'x', "ingotWroughtIron", 'y', new ItemStack(ModBlocks.fence, 1, 0), 'z', paneGlassOreDict[15 - i]));

        target = ((ItemLantern)Item.getItemFromBlock(ModBlocks.lantern)).makeItemStack(1, i, true);
        GameRegistry.addRecipe(new ShapelessOreRecipe(target, new ItemStack(ModBlocks.lantern, 1, 0), paneGlassOreDict[15 - i]));
    }

    for (int i = 0; i < 6; i++) {
        GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.latticeWood, 8, i), " x ", "xxx", " x ", 'x', new ItemStack(Blocks.planks, 1, i));
    }

    GameRegistry.addRecipe(new ItemStack(ModItems.mossPaste), "xyx", "yxy", "xyx", 'x', Blocks.vine, 'y', Items.clay_ball);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.candle, 4, 0), "x", "y", "y", 'x', Items.string, 'y', "materialWax"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.candle, 4, 0), "x", "y", "y", 'x', Items.string, 'y', "materialPressedwax"));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 0), " x ", " y ", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 1), "x x", "y y", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 2), "xxx", "yyy", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.hoop, 2, 0), "xyx", "y y", "xyx",
        'x', "nuggetWroughtIron", 'y', "ingotWroughtIron"));

    GameRegistry.addSmelting(wroughtIronIngot, new ItemStack(Items.iron_ingot), 0);
}
 
源代码22 项目: LetsModReboot   文件: Recipes.java
public static void init()
{
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.mapleLeaf), " s ", "sss", " s ", 's', "stickWood"));
    GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.flag), "stickWood", new ItemStack(ModItems.mapleLeaf)));
}
 
源代码23 项目: Chisel   文件: Crafting.java
public static void init()
{
    Block concreteRecipeBlock = Block.getBlockFromName(Configurations.config.get("tweaks", "concrete recipe block", "gravel", "Unlocalized name of the block that, when burned, will produce concrete (examples: lightgem, stone)").getString());
    if(concreteRecipeBlock == null) concreteRecipeBlock = Blocks.gravel;

    FurnaceRecipes.smelting().func_151393_a(concreteRecipeBlock, new ItemStack(ChiselBlocks.blockConcrete), 0.1F);

    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockSandstoneScribbles, 1), new Object[]{"X", 'X', new ItemStack(ChiselBlocks.blockSandstone, 1, 8),});
    for(int meta = 0; meta < 16; meta++)
    {
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockMarbleSlab, 6, 0), new Object[]{"***", '*', new ItemStack(ChiselBlocks.blockMarble, 1, meta)});
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockLimestoneSlab, 6, 0), new Object[]{"***", '*', new ItemStack(ChiselBlocks.blockLimestone, 1, meta)});
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockMarblePillarSlab, 6, 0), new Object[]{"***", '*', new ItemStack(ChiselBlocks.blockMarblePillar, 1, meta)});

        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockMarblePillar, 6), new Object[]{"XX", "XX", "XX", 'X', new ItemStack(ChiselBlocks.blockMarble, 1, meta),});
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockMarble, 4), new Object[]{"XX", "XX", 'X', new ItemStack(ChiselBlocks.blockMarblePillar, 1, meta),});

        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockIcePillar, 6, 1), new Object[]{"XX", "XX", "XX", 'X', new ItemStack(ChiselBlocks.blockIce, 1, meta),});
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockIce, 4, 1), new Object[]{"XX", "XX", 'X', new ItemStack(ChiselBlocks.blockIcePillar, 1, meta),});

        GameRegistry.addRecipe(new ItemStack(Blocks.sandstone, 1, 1), new Object[]{"X", 'X', new ItemStack(ChiselBlocks.blockSandstoneScribbles, 1, meta),});

        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockCarpet, 8, meta), new Object[]{"YYY", "YXY", "YYY", 'X', new ItemStack(Items.string, 1), 'Y', new ItemStack(Blocks.wool, 1, meta),});
        GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockCarpetFloor, 3, meta), new Object[]{"XX", 'X', new ItemStack(ChiselBlocks.blockCarpet, 1, meta),});
    }

    // The following recipe is due to bugs with Chisel 1.5.1 to 1.5.6a
    GameRegistry.addRecipe(new ItemStack(Blocks.sandstone, 1, 0), new Object[]{"X", 'X', new ItemStack(ChiselBlocks.blockSandstone, 1, 0),});

    // The following recipe is due to bug with Chisel 1.5.6b
    GameRegistry.addRecipe(new ItemStack(Blocks.sandstone, 1, 1), new Object[]{"X", 'X', new ItemStack(ChiselBlocks.blockSandstone, 1, 1),});


    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockHolystone, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.feather, 1)});
    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockLavastone, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.lava_bucket, 1)});
    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockFft, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.gold_nugget, 1)});
    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockTyrian, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.iron_ingot, 1)});
    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockTemple, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.dye, 1, 4)});
    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockFactory, Configurations.factoryBlockAmount, 0), new Object[]{"*X*", "X X", "*X*", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.iron_ingot, 1)});

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.blockRoadLine, 8, 0), new Object[]{"wrw", "wrw", "wrw", ('w'), "dyeWhite", ('r'), Items.redstone}));

    if(Configurations.chiselRecipe)
    {
        GameRegistry.addRecipe(new ItemStack(Chisel.chisel, 1), new Object[]{" YY", " YY", "X  ", 'X', Items.stick, 'Y', Items.iron_ingot});
    } else
    {
        GameRegistry.addRecipe(new ItemStack(Chisel.chisel, 1), new Object[]{" Y", "X ", 'X', Items.stick, 'Y', Items.iron_ingot});
    }

    if(Configurations.featureEnabled("ballOfMoss"))
        GameRegistry.addRecipe(new ItemStack(Chisel.itemBallOMoss, 1), new Object[]{"XYX", "YXY", "XYX", 'X', Blocks.vine, 'Y', Items.stick});
    if(Configurations.featureEnabled("cloud"))
        GameRegistry.addRecipe(new ItemStack(Chisel.itemCloudInABottle, 1), new Object[]{"X X", "XYX", " X ", 'X', Blocks.glass, 'Y', Items.quartz});

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.blockPaperwall, 8), new Object[]{"ppp", "psp", "ppp", ('p'), Items.paper, ('s'), "stickWood"}));

    String[] sGNames = new String[]{
            "White", "Orange", "Magenta", "Light Blue",
            "Yellow", "Lime", "Pink", "Gray",
            "Light Gray", "Cyan", "Purple", "Blue",
            "Brown", "Green", "Red", "Black"
    };

    for(int i = 0; i < 16; i++)
    {
        OreDictionary.registerOre("stainedClay" + sGNames[i].replaceAll(" ", ""), new ItemStack(Blocks.stained_hardened_clay, 1, i));
        OreDictionary.registerOre("blockWool" + sGNames[i].replaceAll(" ", ""), new ItemStack(Blocks.wool, 1, i));
        GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ChiselBlocks.blockWoolenClay, 2, i), new Object[]{"blockWool" + sGNames[i].replaceAll(" ", ""), "stainedClay" + sGNames[i].replaceAll(" ", "")}));
    }

    GameRegistry.addRecipe(new ItemStack(ChiselBlocks.blockLaboratory, 8, 0), new Object[]{"***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.quartz, 1)});

}
 
源代码24 项目: PneumaticCraft   文件: CraftingRegistrator.java
public static void addShapelessRecipe(ItemStack result, Object... recipe){
    GameRegistry.addRecipe(new ShapelessOreRecipe(result, recipe));
}