Custom Crafting

Discussion in 'Resources' started by cruz2000, Nov 23, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    cruz2000

    Hey ever want to make your own custom crafting recipes! Will today am going to show you how so open up that eclipse and lets get started! But first of all there are 2 kinds of recipes Shapeless and Shaped recipes. I will be showing you only shapeless for today!

    Making Shapeless Recipes:
    1. So hopefully you know the basics already and have your onEnable and onDisable it will be needed and extend JavaPlugin. If you don't how to do that go here. http://wiki.bukkit.org/Plugin_Tutorial#onEnable.28.29_and_onDisable.28.29 .
    2. Under onEnable your going to type:

    Code:java
    1. ShapelessRecipe NameOfRecipe = new ShapelessRecipe(new ItemStack(


    3. Under that you want to type:
    Code:java
    1. Material.STRING)).addIngredient(Material.WOOL);


    Alright pay attention here it goes a bit weird.

    (String) represents the material am going to get. In this case when i put wool anywhere in the crafting table inventory ill get a string back. So as you can see this is backwards. So first its the item you want to get. Then the item your going to use to get the item you want to get. Sorry if its a bit confusing but that's how it works.
    4. When your done with that you want to hit return 2 times and then type this:
    Code:java
    1. getServer().addRecipe(THENAMEOFYOURRECIPE);

    In between the parentheses you put the name of your recipe .
    5. Under onDisable you want to put this:
    Code:java
    1. getServer().clearRecipes();

    This is to clear the recipe so you people wont dupe. :)
    7. Make your plugin.yml
    8. You should have this ready to export with plugin.yml and no errors:
    Code:java
    1. package me.cruz2000;
    2.  
    3. import org.bukkit.Material;
    4. import org.bukkit.inventory.ItemStack;
    5. import org.bukkit.inventory.ShapelessRecipe;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class customcrafting extends JavaPlugin{
    9.  
    10. @Override
    11. public void onEnable(){
    12. ShapelessRecipe wool = new ShapelessRecipe(new ItemStack(
    13. Material.STRING)).addIngredient(Material.WOOL);
    14.  
    15. getServer().addRecipe(wool);
    16. }
    17.  
    18. @Override
    19. public void onDisable(){
    20. getServer().clearRecipes();
    21. }
    22.  
    23. }
    24.  


    Now your all done If you need help pm! Ill be glad to help you ! Sorry if step 3 was confusing please pm if you need help ill get back to you quickly as possible!

    Proof.png
     
  2. You might want to change the string in your recipe with something else, as people may confuses it with a String (the Java object)
     
Thread Status:
Not open for further replies.

Share This Page