is there a way to remove all vanilla recipes of an item ?

Discussion in 'Plugin Development' started by cdnyassuo34, Nov 24, 2019.

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

    cdnyassuo34

    Hi, I am working on a custom craft plugin and didn't foud any fast way to remove all crafts of an item, I did something tio erase crafts one by one but is there anway to remove all existing crafts ( the plugin must work in 1.14.4 and in 1.13.2 there is a method that works but not in 1.13.2)
    So, I've tryied with this:
    Code:
    ItemStack its = new ItemStack(Material.AIR, 1);
    ShapedRecipe spdrcp = new ShapedRecipe(its);
    
    spdrcp.shape(new String[] {"ABC","DEF","GHI"});
    spdrcp.setIngredient('A', Material.getMaterial(s3[0]));
    spdrcp.setIngredient('B', Material.getMaterial(s3[1]));
    spdrcp.setIngredient('C', Material.getMaterial(s3[2]));
    
    spdrcp.setIngredient('D', Material.getMaterial(s3[3]));
    spdrcp.setIngredient('E', Material.getMaterial(s3[4]));
    spdrcp.setIngredient('F', Material.getMaterial(s3[5]));
    
    spdrcp.setIngredient('G', Material.getMaterial(s3[6]));
    spdrcp.setIngredient('H', Material.getMaterial(s3[7]));
    spdrcp.setIngredient('I', Material.getMaterial(s3[8]));
    Bukkit.getServer().addRecipe(spdrcp);
    System.out.println("Loaded a deleted craft");
    
    but there is an error with this code :
    Code:
    java.lang.IllegalArgumentException: Recipe must have non-AIR result.
    
    I know the problem is that he result is air but how can I remove a craft ??? I've tryied with this method:
    Bukkit.getServer().recipeIterator()
    but it is still not working . is there a method that remove every recipe of an item ?
    Thanks for any help ^^
     
  2. Offline

    MegaCrafter10

Thread Status:
Not open for further replies.

Share This Page