-
Notifications
You must be signed in to change notification settings - Fork 1
1. Create recipes
You can create every type recipes with the api.
You can choose between following recipe types:
RecipeShaped - This is a shaped recipe. You can set a shape.
RecipeShapeless - This is not shaped recipe. In this recipe, you can not set a shape
RecipeFurnace - This is the furnace recipe
Create a new shaped recipe:
RecipeShaped recipe = new RecipeShaped("name", output);
The first parameter is the name for the recipe. The second parameter, is the output itemstack
Now, you can set the shape with recipe.shape("01234", "56789", "01234", "56789", "01234") - The Shape must be hase a max length from 5. Every number, can a character. The first "01234" is row 1, the second is row 2.. and so on.. if you'll air, then make a space. Here is a example recipe
recipe.shape("DD DD", "II II") - This example, set in the first row the first second slots and the last second slots. And the same for the second row. The other 3 rows, are ignored. Now, when you set the shape you must set the ingredient.
Call .setIngredient(char c, ItemStack itemStack) - The charachter, is the char where you use in the shape. in my exmaple is set 2 ingredients: .setIngredient('D', new ItemStack(Material.DIAMOND, 2)).setIngredient('I', new ItemStack(Material.IRON_INGOT)) - every character, must be a itemstack. If you finish, then call .create() to finish up the recipe.
Now, you can add the ingredient with addIngredient(ItemStack itemStack) - If you finish up, then add the recipe with the RecipeManager to the plugin (Scroll down, for the recipe-manager)
Create a new shapeless recipe:
RecipeShapeless recipe = new RecipeShapeless(name, output) - The first parameter is the recipe name, and the second parameter is the output itemstack
Now, you can add the ingredient with addIngredient(ItemStack itemStack) - If you finish up, then add the recipe with the RecipeManager to the plugin (Scroll down, for the recipe-manager)
Create a new furnace recipe:
RecipeFurnace recipe = new RecipeFurnace(name, output) - The first parameter is the recipe name, and the second parameter is the output itemstack
Now, you must set the input item with setInput(ItemStack input). Optional, is the setExperience(float experience) method. With this method you can set the experience.
Now, when you create your recipes. You need the RecipeManager
The RecipeManager can you get from the getRecipeManager() method in the MoreCrafting class. Just call: MoreCrafting.getInstance().getRecipeManager()
Now when you get the RecipeManager just call the method addRecipe(ARecipe recipe) and, put in the first parameter your recipe. The class ARecipe is a abstract class, where represent a recipe