CustomRecipeLib 2018-03-30-3

Create custom recipes using ItemStacks instead of just Materials.

  1. facemywrath
    Tested Minecraft Versions:
    • 1.12
    This library is used to create custom recipes that use ItemStacks as a requirement instead of just Materials. It allows you to edit name and lore using this.

    NOTE: THIS ONLY WORKS IN WORKBENCH INVENTORIES CURRENTLY

    CShapedRecipe Example:
    Code (Text):
    List<String> recipe = Arrays.asList("xxx", "xox", "xxx");
    HashMap<ItemStack, Character> chars = new HashMap<>();
    ItemStack item = new ItemStack(Material.STONE, 1);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName("HELLO");
    item.setItemMeta(meta);
    chars.put(item, 'x');
    chars.put(new ItemStack(Material.AIR), 'o');
    ItemStack result = new ItemStack(Material.DIAMOND, 10);
    facemywrath.srlib.main.CustomRecipeLib.registerCustomRecipe(new CShapedRecipe(recipe, chars, result));
     
    CShapelessRecipe Example:
    Code (Text):
    ItemStack item = new ItemStack(Material.STONE, 1);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName("HELLO");
    item.setItemMeta(meta);
    ItemStack result = new ItemStack(Material.DIAMOND, 10);
    HashMap<ItemStack, Integer> shapeless = new HashMap<>();
    shapeless.put(item, 4);
    facemywrath.srlib.main.CustomRecipeLib.registerCustomRecipe(new CShapelessRecipe(shapeless, result));
    The integer value for the hashmap is the number of slots which will have that item in it.

    I also added a RecipeFoundEvent for when it finds a custom recipe