Java Code Examples for org.bukkit.Bukkit#addRecipe()

The following examples show how to use org.bukkit.Bukkit#addRecipe() . 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: GoldenHeadsModule.java    From UHC with MIT License 6 votes vote down vote up
public GoldenHeadsModule() {
    setId("GoldenHeads");

    this.iconName = ICON_NAME;
    this.icon.setType(Material.SKULL_ITEM);
    this.icon.setDurability(PlayerHeadProvider.PLAYER_HEAD_DATA);
    this.icon.setWeight(ModuleRegistry.CATEGORY_APPLES);

    // register the new recipe
    final ShapedRecipe modified = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1))
            .shape("AAA", "ABA", "AAA")
            .setIngredient('A', Material.GOLD_INGOT)
            .setIngredient('B', Material.SKULL_ITEM, PlayerHeadProvider.PLAYER_HEAD_DATA);

    Bukkit.addRecipe(modified);
}
 
Example 2
Source File: PipeManager.java    From Transport-Pipes with MIT License 5 votes vote down vote up
@Override
public void registerRecipes() {
    BaseDuctType<Pipe> pipeBaseDuctType = ductRegister.baseDuctTypeOf("pipe");

    DuctType ductType;

    ductType = pipeBaseDuctType.ductTypeOf("White");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "white_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "a a", " a "}, 'a', Material.GLASS));
    ductType = pipeBaseDuctType.ductTypeOf("Blue");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "blue_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.LAPIS_LAZULI));
    ductType = pipeBaseDuctType.ductTypeOf("Red");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "red_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', LegacyUtils.getInstance().getRedDye()));
    ductType = pipeBaseDuctType.ductTypeOf("Yellow");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "yellow_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', LegacyUtils.getInstance().getYellowDye()));
    ductType = pipeBaseDuctType.ductTypeOf("Green");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "green_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', LegacyUtils.getInstance().getGreenDye()));
    ductType = pipeBaseDuctType.ductTypeOf("Black");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "black_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.INK_SAC));
    ductType = pipeBaseDuctType.ductTypeOf("Golden");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "golden_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.GOLD_BLOCK));
    ductType = pipeBaseDuctType.ductTypeOf("Iron");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "iron_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.IRON_BLOCK));
    ductType = pipeBaseDuctType.ductTypeOf("Ice");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "ice_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.SNOW_BLOCK));
    ductType = pipeBaseDuctType.ductTypeOf("Void");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "void_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.OBSIDIAN));
    ductType = pipeBaseDuctType.ductTypeOf("Extraction");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "extraction_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Tag.PLANKS.getValues()));
    ductType = pipeBaseDuctType.ductTypeOf("Crafting");
    ductType.setDuctRecipe(itemService.createShapedRecipe(transportPipes, "crafting_pipe", pipeBaseDuctType.getItemManager().getClonedItem(ductType), new String[]{" a ", "aba", " a "}, 'a', Material.GLASS, 'b', Material.CRAFTING_TABLE));

    wrenchRecipe = itemService.createShapedRecipe(transportPipes, "wrench", itemService.getWrench(), new String[]{" a ", "aba", " a "}, 'a', Material.REDSTONE, 'b', Material.STICK);
    Bukkit.addRecipe(wrenchRecipe);
}
 
Example 3
Source File: GoldenCarrotRecipeModule.java    From UHC with MIT License 5 votes vote down vote up
public GoldenCarrotRecipeModule() {
    setId("GoldenCarrotRecipe");

    this.iconName = ICON_NAME;
    this.icon.setType(Material.GOLDEN_CARROT);
    this.icon.setWeight(ModuleRegistry.CATEGORY_RECIPIES);

    // register the new recipe
    final ShapedRecipe modified = new ShapedRecipe(new ItemStack(Material.GOLDEN_CARROT, 1))
            .shape("AAA", "ABA", "AAA")
            .setIngredient('A', Material.GOLD_INGOT)
            .setIngredient('B', Material.CARROT_ITEM);

    Bukkit.addRecipe(modified);
}
 
Example 4
Source File: GlisteringMelonRecipeModule.java    From UHC with MIT License 5 votes vote down vote up
public GlisteringMelonRecipeModule() {
    setId("GlisteringMelonRecipe");

    this.iconName = ICON_NAME;
    this.icon.setType(Material.SPECKLED_MELON);
    this.icon.setWeight(ModuleRegistry.CATEGORY_RECIPIES);

    final ShapelessRecipe modified = new ShapelessRecipe(new ItemStack(Material.SPECKLED_MELON, 1))
            .addIngredient(1, Material.GOLD_BLOCK)
            .addIngredient(1, Material.MELON);

    Bukkit.addRecipe(modified);
}
 
Example 5
Source File: RecipesBanners.java    From Carbon with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void register() {
	//basic recipes
	for (int c = 0; c < 16; c++) {
		@SuppressWarnings("deprecation")
		ShapedRecipe defaultBanners = new ShapedRecipe(new ItemStack(Carbon.injector().bannerItemMat, 1, (short) (15 - c))).shape(new String[] { "www", "www", " s " }).setIngredient('w', Material.WOOL, c).setIngredient('s', Material.STICK);
		Bukkit.addRecipe(defaultBanners);
	}

	//patterns recipe
	CraftingManager.getInstance().getRecipes().add(new RecipesBannerPatterns());

	//copy recipe
	CraftingManager.getInstance().getRecipes().add(new RecipesBannerCopy());
}
 
Example 6
Source File: DuctType.java    From Transport-Pipes with MIT License 4 votes vote down vote up
public void setDuctRecipe(Recipe ductRecipe) {
    this.ductRecipe = ductRecipe;
    Bukkit.addRecipe(ductRecipe);
}
 
Example 7
Source File: CustomRecipe.java    From AdditionsAPI with MIT License 4 votes vote down vote up
@Deprecated
public CustomRecipe registerBukkitRecipe(ItemStack result) {
	Recipe recipe = toBukkitRecipe(result);
	Bukkit.addRecipe(recipe);
	return this;
}
 
Example 8
Source File: CustomRecipe.java    From AdditionsAPI with MIT License 4 votes vote down vote up
public CustomRecipe registerBukkitRecipe(NamespacedKey key, ItemStack result) {
	Recipe recipe = toBukkitRecipe(key, result);
	Bukkit.addRecipe(recipe);
	return this;
}
 
Example 9
Source File: Archer.java    From AnnihilationPro with MIT License 4 votes vote down vote up
@Override
protected void setUp()
{
	ShapelessRecipe recipe = new ShapelessRecipe(new ItemStack(Material.ARROW,3)).addIngredient(Material.FLINT).addIngredient(Material.STICK);
	Bukkit.addRecipe(recipe);	
}
 
Example 10
Source File: NotchApplesModule.java    From UHC with MIT License 4 votes vote down vote up
@Override
protected void onEnable() {
    final boolean recipeExists = Iterators.any(Bukkit.recipeIterator(), IS_NOTCH_APPLE_RECIPE);
    if (!recipeExists) Bukkit.addRecipe(NOTCH_APPLE_RECIPE);
}