public void registerRecipes() { Bukkit.resetRecipes(); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.BEETROOT_SOUP)).shape(new String[] {"rrr", "rrr", " b "}).setIngredient('r', MaterialList.BEETROOT).setIngredient('b', org.bukkit.Material.BOWL)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.END_BRICKS)).shape(new String[] {"ee", "ee"}).setIngredient('e', org.bukkit.Material.ENDER_STONE)); //Purpur block recipes addRecipe(new FurnaceRecipe(new ItemStack(MaterialList.CHORUS_FRUIT_POPPED), MaterialList.CHORUS_FRUIT)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_BLOCK, 4)).shape(new String[] {"pp", "pp"}).setIngredient('p', MaterialList.CHORUS_FRUIT_POPPED)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_STAIRS, 4)).shape(new String[] {"p ", "pp ", "ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_STAIRS, 4)).shape(new String[] {" p", " pp", "ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_SLAB, 6)).shape(new String[] {"ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK)); addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_PILLAR)).shape(new String[] {"s", "s"}).setIngredient('s', MaterialList.PURPUR_SLAB)); //Arrows addRecipe(new ShapedRecipe(new ItemStack(MaterialList.SPECTRAL_ARROW, 2)).shape(new String[] {" d ", "dad", " d "}).setIngredient('d', org.bukkit.Material.GLOWSTONE_DUST).setIngredient('a', org.bukkit.Material.ARROW)); }
public static void setupRecipes() { for (String key : SensibleToolbox.getItemRegistry().getItemIds()) { // add custom workbench recipes BaseSTBItem item = SensibleToolbox.getItemRegistry().getItemById(key); Recipe r = item.getRecipe(); if (r != null) { Bukkit.addRecipe(r); } for (Recipe r2 : item.getExtraRecipes()) { Bukkit.addRecipe(r2); } // add custom furnace recipes ItemStack stack = item.getSmeltingResult(); if (stack != null) { Bukkit.addRecipe(new FurnaceRecipe(stack, item.getMaterialData())); recordReverseSmelt(stack, item.toItemStack()); } // add custom processing recipes for any machine items if (item instanceof BaseSTBMachine) { ((BaseSTBMachine) item).addCustomRecipes(CustomRecipeManager.getManager()); } } }
@Override public void addCustomRecipes(CustomRecipeManager crm) { // add a corresponding smelter recipe for every known vanilla furnace recipe Iterator<Recipe> iter = Bukkit.recipeIterator(); while (iter.hasNext()) { Recipe r = iter.next(); if (r instanceof FurnaceRecipe) { FurnaceRecipe fr = (FurnaceRecipe) r; if (RecipeUtil.isVanillaSmelt(fr.getInput().getType())) { crm.addCustomRecipe(new SimpleCustomRecipe(this, fr.getInput(), fr.getResult(), getProcessingTime(fr.getInput()))); } } } // add a processing recipe for any STB item which reports itself as smeltable for (String key : SensibleToolbox.getItemRegistry().getItemIds()) { BaseSTBItem item = SensibleToolbox.getItemRegistry().getItemById(key); if (item.getSmeltingResult() != null) { ItemStack stack = item.toItemStack(); crm.addCustomRecipe(new SimpleCustomRecipe(this, stack, item.getSmeltingResult(), getProcessingTime(stack))); } } }
public Recipe parseSmeltingRecipe(MapModuleContext context, Element elRecipe) throws InvalidXMLException { MaterialPattern ingredient = XMLUtils.parseMaterialPattern(XMLUtils.getRequiredUniqueChild(elRecipe, "ingredient", "i")); ItemStack result = parseRecipeResult(context, elRecipe); if(ingredient.dataMatters()) { return new FurnaceRecipe(result, ingredient.getMaterialData()); } else { return new FurnaceRecipe(result, ingredient.getMaterial()); } }
public static ItemStack getSmeltedOutput(Material type) { ItemStack result = null; Iterator<Recipe> iter = Bukkit.recipeIterator(); while (iter.hasNext()) { Recipe recipe = iter.next(); if (!(recipe instanceof FurnaceRecipe)) continue; if (((FurnaceRecipe) recipe).getInput().getType() != type) continue; result = recipe.getResult(); break; } return result; }
public static <T> T accept(Recipe recipe, RecipeVisitor<T> visitor) { if (recipe instanceof ShapedRecipe) { ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; return visitor.visit(shapedRecipe); } else if (recipe instanceof ShapelessRecipe) { ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; return visitor.visit(shapelessRecipe); } else if (recipe instanceof FurnaceRecipe) { FurnaceRecipe furnaceRecipe = (FurnaceRecipe) recipe; return visitor.visit(furnaceRecipe); } return visitor.visitOther(recipe); }
@Override public void registerDefaultRecipes() { Iterator<Recipe> iterator = Bukkit.recipeIterator(); while (iterator.hasNext()) { Recipe r = iterator.next(); if (r instanceof FurnaceRecipe) { registerRecipe(4, new ItemStack[] {((FurnaceRecipe) r).getInput()}, new ItemStack[] {r.getResult()}); } } }
static void addAllRecipes (FileConfiguration config) { if (config.getBoolean("allowFleshSmelt")) { Bukkit.addRecipe(new FurnaceRecipe(new ItemStack(Material.LEATHER),Material.ROTTEN_FLESH)); } if (config.getBoolean("allowJerky")){ ShapelessRecipe jerky = new ShapelessRecipe(new ItemStack(Material.RAW_BEEF)); jerky.addIngredient(2, Material.ROTTEN_FLESH); jerky.addIngredient(Material.SUGAR); Bukkit.addRecipe(jerky); } }
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 } } }
private static Set<Material> getBurnableMaterials() { Set<Material> burnables = new HashSet<Material>(24); for (Iterator<Recipe> it = MachinaCore.plugin.getServer().recipeIterator(); it.hasNext();) { Recipe recipe = it.next(); if (recipe instanceof FurnaceRecipe) { burnables.add(((FurnaceRecipe) recipe).getInput().getType()); } } return burnables; }
public static boolean isSmelted(ItemStack item) { if (item == null) { return false; } for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) { if (recipe instanceof FurnaceRecipe) { return MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData()); } } return false; }
public static void findVanillaFurnaceMaterials() { Iterator<Recipe> iter = Bukkit.recipeIterator(); while (iter.hasNext()) { Recipe r = iter.next(); if (r instanceof FurnaceRecipe) { Material mat = ((FurnaceRecipe) r).getInput().getType(); vanillaSmelts.add(mat); recordReverseSmelt(r.getResult(), ((FurnaceRecipe) r).getInput()); } } }
public static CraftFurnaceRecipe fromBukkitRecipe(FurnaceRecipe recipe) { if (recipe instanceof CraftFurnaceRecipe) { return (CraftFurnaceRecipe) recipe; } return new CraftFurnaceRecipe(recipe.getResult(), recipe.getInput()); }
public void enable() { log("FleshToLeather:"); plugin.getServer().addRecipe(new FurnaceRecipe(new ItemStack(Material.LEATHER), Material.ROTTEN_FLESH)); log("Enabled"); }
public FurnaceRecipe(ItemStack result, Material source) { }
public FurnaceRecipe(ItemStack result, MaterialData source) { }
@Deprecated public FurnaceRecipe(ItemStack result, Material source, int data) { }
public FurnaceRecipe setInput(MaterialData input) { return null; }
public FurnaceRecipe setInput(Material input) { return null; }
@Deprecated public FurnaceRecipe setInput(Material input, int data) { return null; }
public SmeltRecipe(ItemStack result, MaterialData source) { setRecipe(new FurnaceRecipe(result, source)); }
T visit(FurnaceRecipe furnaceRecipe);