Furnace & Crafting Recipe with damaged and new items

Discussion in 'Plugin Development' started by Lord_Rius, Mar 29, 2013.

Thread Status:
Not open for further replies.
  1. Hello, i'm new in bukkit coding and i'm making a simple plugin about smelting and repairing tools.
    Well my first problem in Furnace Recipes, i want to smelt only new items and not damaged, i used this code:
    Code:
    FurnaceRecipe ironSwordSmelt = new FurnaceRecipe(new ItemStack(Material.IRON_INGOT), Material.IRON_SWORD, 1);
            ironSwordSmelt.setInput(Material.IRON_SWORD, 1);
            server.addRecipe(ironSwordSmelt);
    and i tried to change 1, 0 and -1 but always smelt damaged and not damaged sword.

    My second problem is very similar, but in crafting recipe, this is the code:
    Code:
            ShapelessRecipe woodenSwordRepair = new ShapelessRecipe(new ItemStack(Material.WOOD_SWORD));
            woodenSwordRepair.addIngredient(Material.WOOD_SWORD, -1);
            woodenSwordRepair.addIngredient(Material.WOOD);
            server.addRecipe(woodenSwordRepair);
    In this case, i only want to repair damaged items not new ones.

    I hope somebody help me, sorry for my english, i'm spanish.
     
  2. Offline

    caseif

    Listen to the PrepareCraftItemEvent and check the durability of each item.
     
  3. Thanks, can you show me an example of the code please?
     
Thread Status:
Not open for further replies.

Share This Page