net.minecraftforge.oredict.ShapelessOreRecipe Java Examples

The following examples show how to use net.minecraftforge.oredict.ShapelessOreRecipe. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetaItemShapelessRecipeFactory.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #3
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #4
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
    }
}
 
Example #5
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #6
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #7
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
    }
}
 
Example #8
Source File: ShapelessRecipe.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #9
Source File: RecipeHandlerRollingMachineShapeless.java    From NEI-Integration with MIT License 5 votes vote down vote up
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;
}
 
Example #10
Source File: Recipes.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
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);

}
 
Example #11
Source File: ClientProxy.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example #12
Source File: RecipeHandlerRollingMachineShapeless.java    From NEI-Integration with MIT License 5 votes vote down vote up
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);
}
 
Example #13
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
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());
}
 
Example #14
Source File: ShapelessRecipe.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
private boolean matchesInput(IRecipe recipe)
{
    if (recipe instanceof ShapelessRecipes)
    {
        return matchesInput((ShapelessRecipes) recipe);
    } else if (recipe instanceof ShapelessOreRecipe)
    {
        return matchesInput((ShapelessOreRecipe) recipe);
    }

    return false;
}
 
Example #15
Source File: Recipes.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
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));
}
 
Example #16
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
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());
}
 
Example #17
Source File: ModHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: ModRecipes.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
private static void addShapelessRecipe(ItemStack output, Object... objects) {
	GameRegistry.addRecipe(new ShapelessOreRecipe(output, objects));
}
 
Example #19
Source File: ModRecipes.java    From GardenCollection with MIT License 4 votes vote down vote up
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);
    }
}
 
Example #20
Source File: ModRecipes.java    From GardenCollection with MIT License 4 votes vote down vote up
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);
}
 
Example #21
Source File: Recipes.java    From LetsModReboot with GNU General Public License v3.0 4 votes vote down vote up
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)));
}
 
Example #22
Source File: Crafting.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
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)});

}
 
Example #23
Source File: CraftingRegistrator.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public static void addShapelessRecipe(ItemStack result, Object... recipe){
    GameRegistry.addRecipe(new ShapelessOreRecipe(result, recipe));
}
 
Example #24
Source File: ShapelessRecipeTests.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
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"));
}