static void removeAllRecipes() {
Recipe recipe;
// Check iterator for any of our recipes, if so, remove them
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
recipe = iter.next();
// Check if this Recipe is one of the ones we are responsible for
// First, Furnace Recipes
try {
if (recipe instanceof FurnaceRecipe) {
if ((Material.LEATHER == recipe.getResult().getType()) &&
(Material.ROTTEN_FLESH == ((FurnaceRecipe) recipe).getInput().getType())){
iter.remove();
}
}
// Check for our Shapeless Recipes
if (recipe instanceof ShapelessRecipe) {
if (Material.RAW_BEEF == recipe.getResult().getType()) {
List<ItemStack> ingredients = ((ShapelessRecipe) recipe).getIngredientList();
if (3 == ingredients.size() &&
ingredients.contains(new ItemStack(Material.ROTTEN_FLESH)) &&
ingredients.contains(new ItemStack(Material.SUGAR))) {
iter.remove();
}
}
}
}
catch (NullPointerException e) {
System.out.print("[ERROR]: Failed to process Recipe iterator");
e.printStackTrace();
// Don't rethrow, attempt recovery
}
}
}
BetterRecipes.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:StarQuestCode
作者:
评论列表
文章目录