Sueta
CU

CustomRecipeLib

2018-03-30-3

Create custom recipes using ItemStacks instead of just Materials.

·Plugin

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:

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:

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

Similar projects

Plugin →