Custom Items in a crafting recipe?

Discussion in 'Plugin Development' started by TheDiamond06, Dec 27, 2014.

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

    TheDiamond06

    I am trying to make it so in the crafting recipe of a custom item has custom itemstacks in it:
    Code:
            ItemStack UnCommonCrate = new ItemStack(Material.CHEST);
            ItemMeta im = UnCommonCrate.getItemMeta();
            im.setDisplayName("§c§lUn§b§lCommon Crate");
            List<String> lore = new ArrayList<String>();
           lore.add("§b§l§oRight Click to Open " + ChatColor.RED + "[Can Contain Rarities 20-24]");
           im.setLore(lore);
            UnCommonCrate.setItemMeta(im);
    ||||||||||||||||||||||||||||||||||||||||||||||||||||||
            ItemStack uncommonfragment = new ItemStack(Material.CHEST);
            ItemMeta uncommonfrag = uncommonfragment.getItemMeta();
            uncommonfrag.setDisplayName("§c§lUn§b§lCommon Crate Fragment");
            List<String> lorea = new ArrayList<String>();
            lorea.add("§7§lPut 8 of these with a CommonCrate in the middle to craft the Next Tier Crate!");
            uncommonfrag.setLore(lorea);
            uncommonfragment.setItemMeta(uncommonfrag);
    ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
            ShapedRecipe uncommon = new ShapedRecipe(UnCommonCrate);
            uncommon.shape(new String[]{"AAA","ABA","AAA}) ---> Past here I know I put setIngredient, but
    
    I don't know how to set 'A' to a custom ItemStack, same with 'B'
    If anyone can tell me how that would be great. :D
     
    Last edited: Dec 28, 2014
  2. Offline

    HeadGam3z

  3. Offline

    TheDiamond06

    I meant setting 'A' and 'B' to a custom ItemStack Above
    Code:
    [LIST=1]
    [*]        ItemStack uncommonfragment = new ItemStack(Material.CHEST);
    [*]        ItemMeta uncommonfrag = uncommonfragment.getItemMeta();
    [*]        uncommonfrag.setDisplayName("§c§lUn§b§lCommon Crate Fragment");
    [*]        List<String> lorea = new ArrayList<String>();
    [*]        lorea.add("§7§lPut 8 of these with a CommonCrate in the middle to craft the Next Tier Crate!");
    [*]        uncommonfrag.setLore(lorea);
    [*]        uncommonfragment.setItemMeta(uncommonfrag);
    [*]
    [/LIST]
     
  4. Offline

    DemKazoo

    Eh wtf is up with the "|||||||||||||||||||||||||||||||||||||||||||||||||||||" in your code..

    Anyways, there are lots LOTS of tutorials on the forums on how to do this, did you even check?
     
  5. Offline

    TheDiamond06

    I looked for tutorials on this before hand. Couldn't find any. I found lots on how to make custom crafting recipes but not on how to have an item in the crafting recipe a custom ItemStack.

    Like A = the ItemStack uncommonfragment.
    and B = the ItemStack commoncrate
     
  6. Offline

    HeadGam3z

  7. Offline

    TheDiamond06

    I read it, just says things about the format: char, Ingredient
    besides the Ingredient I want to make it an ItemStack.
    the uncommonfragment I made in my code above.
    I did see something about material data but, I tried changing the ItemStack to material data and it messed all the display names, and lores up.
     
  8. Offline

    Fuzzybear04

    Use "setIngredient("symbol", customItemStack.getData()):"
     
  9. Offline

    TheDiamond06

    Doesn't work. Says it is an unknown variable.
     
Thread Status:
Not open for further replies.

Share This Page