Solved Furnace Recipes not working?

Discussion in 'Plugin Development' started by russjr08, Nov 29, 2013.

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

    russjr08

    I'm trying to add a furnace Recipe with the following:

    Code:java
    1. FurnaceRecipe bread = new FurnaceRecipe(new ItemStack(Material.BREAD, 1), Material.WHEAT);
    2. bread.setInput(Material.WHEAT);
    3. Logger.log(bread.getInput().toString() + " = " + bread.getResult().toString());
    4.  
    5. getServer().addRecipe(bread);
    6.  
    7. Bukkit.addRecipe(bread);


    (Yes, I know that you don't need to call getServer().addRecipe() and Bukkit.addRecipe(), but for testing purposes...)
    The furnace recipe isn't added. This is called on my onEnable method...

    I'm using CraftBukkit version git-Bukkit-1.6.4-R2.0, the Recommended Build. Any insight on what's wrong?
     
  2. Offline

    sgtcaze

    Worked for me. Make sure to stick the method in your onEnable so Bukkit knows it's there. Example:
    Code:java
    1. @Override
    2. public void onEnable() {
    3. method();
    4. }
    5.  
    6. public void method(){
    7. FurnaceRecipe bread = new FurnaceRecipe(new ItemStack(Material.BREAD, 1), Material.WHEAT);
    8. bread.setInput(Material.WHEAT);
    9.  
    10. getServer().addRecipe(bread);
    11.  
    12. Bukkit.addRecipe(bread);
    13. }
     
  3. Offline

    russjr08

    Thanks, your response cleared the cobwebs :) I realized that I was removing recipes with the result of bread by looping through the recipes in-game already. I was adding the smelting recipe BEFORE that, so it was getting removed too...


    Smart me, ha.
     
Thread Status:
Not open for further replies.

Share This Page