org.bukkit.inventory.FurnaceRecipe Java Examples
The following examples show how to use
org.bukkit.inventory.FurnaceRecipe.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecipeFurnace.java From ProRecipes with GNU General Public License v2.0 | 6 votes |
public boolean register(){ Iterator<org.bukkit.inventory.Recipe> it = ProRecipes.getPlugin().defaultRecipes.iterator(); org.bukkit.inventory.Recipe recipe; while(it.hasNext()) { recipe = it.next(); if (recipe != null && recipe instanceof FurnaceRecipe) { FurnaceRecipe r = (FurnaceRecipe)recipe; if(r.getInput().getType().equals(toBurn.getType())){ def = true; original = r; } } } boolean b = ProRecipes.getPlugin().getRecipes().addFurnace(this); ProRecipes.getPlugin().getServer().addRecipe(register); return b; }
Example #2
Source File: Injector.java From Carbon-2 with GNU Lesser General Public License v3.0 | 6 votes |
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)); }
Example #3
Source File: CraftServer.java From Thermos with GNU General Public License v3.0 | 6 votes |
@Override public boolean addRecipe(Recipe recipe) { CraftRecipe toAdd; if (recipe instanceof CraftRecipe) { toAdd = (CraftRecipe) recipe; } else { if (recipe instanceof ShapedRecipe) { toAdd = CraftShapedRecipe.fromBukkitRecipe((ShapedRecipe) recipe); } else if (recipe instanceof ShapelessRecipe) { toAdd = CraftShapelessRecipe.fromBukkitRecipe((ShapelessRecipe) recipe); } else if (recipe instanceof FurnaceRecipe) { toAdd = CraftFurnaceRecipe.fromBukkitRecipe((FurnaceRecipe) recipe); } else { return false; } } toAdd.addToCraftingManager(); //net.minecraft.item.crafting.CraftingManager.getInstance().sort(); // Cauldron - mod recipes not necessarily sortable return true; }
Example #4
Source File: Injector.java From Carbon-2 with GNU Lesser General Public License v3.0 | 6 votes |
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)); }
Example #5
Source File: TestRecipeService.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
@Test public void testRecipe() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test"); ItemStack result = new ItemStack(Material.EMERALD_BLOCK); FurnaceRecipe recipe = new FurnaceRecipe(key, result, new MaterialChoice(Material.DIAMOND), 1, 2); server.addRecipe(recipe); // The Snapshot has not been taken, so it should fallback to an empty array Assertions.assertEquals(0, service.getRecipesFor(result).length); service.refresh(); Recipe[] recipes = service.getRecipesFor(result); Assertions.assertEquals(1, recipes.length); Assertions.assertEquals(recipe, recipes[0]); }
Example #6
Source File: TestRecipeService.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
@Test public void testFurnaceOutput() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test2"); ItemStack result = new ItemStack(Material.GOLD_BLOCK); MaterialChoice materials = new MaterialChoice(Material.DIRT, Material.COBBLESTONE); FurnaceRecipe recipe = new FurnaceRecipe(key, result, materials, 1, 2); server.addRecipe(recipe); // The Snapshot has not been taken, so it should fallback to an empty Optional Assertions.assertFalse(service.getFurnaceOutput(new ItemStack(Material.DIRT)).isPresent()); service.refresh(); Assertions.assertFalse(service.getFurnaceOutput(null).isPresent()); Assertions.assertFalse(service.getFurnaceOutput(new ItemStack(Material.BEDROCK)).isPresent()); Optional<ItemStack> optional = service.getFurnaceOutput(new ItemStack(Material.DIRT)); Assertions.assertTrue(optional.isPresent()); Assertions.assertEquals(result, optional.get()); Optional<ItemStack> optional2 = service.getFurnaceOutput(new ItemStack(Material.COBBLESTONE)); Assertions.assertTrue(optional2.isPresent()); Assertions.assertEquals(result, optional2.get()); }
Example #7
Source File: CraftingModule.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
public Recipe parseSmeltingRecipe(MapFactory factory, Element elRecipe) throws InvalidXMLException { SingleMaterialMatcher ingredient = XMLUtils.parseMaterialPattern( XMLUtils.getRequiredUniqueChild(elRecipe, "ingredient", "i")); ItemStack result = parseRecipeResult(factory, elRecipe); if (ingredient.dataMatters()) { return new FurnaceRecipe(result, ingredient.getMaterialData()); } else { return new FurnaceRecipe(result, ingredient.getMaterial()); } }
Example #8
Source File: CraftingModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
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()); } }
Example #9
Source File: NMSUtils.java From Transport-Pipes with MIT License | 5 votes |
public static boolean isFurnaceBurnableItem(ItemStack item) { Iterator<Recipe> recipeIt = Bukkit.recipeIterator(); while (recipeIt.hasNext()) { Recipe recipe = recipeIt.next(); if (!(recipe instanceof FurnaceRecipe)) continue; if(!((FurnaceRecipe) recipe).getInputChoice().test(item)) continue; return true; } return false; }
Example #10
Source File: RecipeFurnace.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public RecipeFurnace(ItemStack r, ItemStack t){ this.result = r; this.toBurn = t; id = ""; def = false; register = new FurnaceRecipe(result, toBurn.getType(),(int)toBurn.getDurability()); }
Example #11
Source File: RecipeCalculator.java From CS-CoreLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #12
Source File: ElectricFurnace.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@Override public void registerDefaultRecipes() { SlimefunPlugin.getMinecraftRecipeService().subscribe(snapshot -> { for (FurnaceRecipe recipe : snapshot.getRecipes(FurnaceRecipe.class)) { RecipeChoice choice = recipe.getInputChoice(); if (choice instanceof MaterialChoice) { for (Material input : ((MaterialChoice) choice).getChoices()) { registerRecipe(4, new ItemStack[] { new ItemStack(input) }, new ItemStack[] { recipe.getResult() }); } } } }); }
Example #13
Source File: CraftFurnaceRecipe.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static CraftFurnaceRecipe fromBukkitRecipe(FurnaceRecipe recipe) { if (recipe instanceof CraftFurnaceRecipe) { return (CraftFurnaceRecipe) recipe; } return new CraftFurnaceRecipe(recipe.getResult(), recipe.getInput()); }
Example #14
Source File: CustomFurnaceRecipe.java From AdditionsAPI with MIT License | 4 votes |
@Override public FurnaceRecipe toBukkitRecipe(ItemStack result) { return toBukkitRecipe(null, result); }
Example #15
Source File: CraftFurnaceRecipe.java From Thermos with GNU General Public License v3.0 | 4 votes |
public static CraftFurnaceRecipe fromBukkitRecipe(FurnaceRecipe recipe) { if (recipe instanceof CraftFurnaceRecipe) { return (CraftFurnaceRecipe) recipe; } return new CraftFurnaceRecipe(recipe.getResult(), recipe.getInput()); }
Example #16
Source File: SmeltRecipe.java From CardinalPGM with MIT License | 4 votes |
public SmeltRecipe(ItemStack result, MaterialData source) { setRecipe(new FurnaceRecipe(result, source)); }