Using Custom Items for custom crafting recipes

Discussion in 'Plugin Development' started by xXDevastationXx, Feb 15, 2015.

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

    xXDevastationXx

    Problem: I am trying to make it so I can only use a specific type of item (Blaze essence is what i'm doing), but I dont know how to make it so it uses the metadata.

    I Just need the knowledge of what to do, the idea is that they cant just use blaze powder, they need to use blaze powder named specificly "Blaze essence"

    I have a bunch of custom crafting recipes, Ill just take out those and show what is needed
    Code:
            ItemStack Blaze = new ItemStack(Material.BLAZE_POWDER, 1); //Im doing this here to show this is my "Blaze essence"
            ItemMeta meta = Blaze.getItemMeta();
            meta.setDisplayName("§eBlaze §cEssence");
            List<String> lore = new ArrayList<String>();
            lore.add("§7Used In &eSword of Arkham §7Recipe");
    Code:
    private void Drecipe() {
        ItemStack Sword = new ItemStack(Material.DIAMOND_SWORD, 1);
        ItemMeta meta = Sword.getItemMeta();
        meta.setDisplayName("§b§l(!)§eSword of Arkham§b§l(!)");
        Sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5);
        Sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 4);
        List<String> lore = new ArrayList<String>();
        lore.add("§7Devastation Lvl I");
        meta.setLore(lore);
        Sword.setItemMeta(meta);
      
        ShapedRecipe Drecipe = new ShapedRecipe(Sword);
        Drecipe.shape( 
    " @ ",
    "*@*",
    " # "
                       );
        Drecipe.setIngredient('@', Material.DIAMOND_BLOCK);
        Drecipe.setIngredient('#', Material.STICK);
        Drecipe.setIngredient('*', Material.BLAZE_POWDER); //I dont want "Blaze powder" I want to make it "blaze essence"
        Bukkit.getServer().addRecipe(Drecipe);
     
  2. Offline

    hopstar

    Sorry i did have the same problem. I couldn't find anything
     
  3. Offline

    Davesan

    Hello, I think you should check the crafting events and mess around there.. I think there are event for crafting, then you can set the crafting result. Check through the ingredients and if there are special items you set the result for nothing (null/air idk). If the ingredients match one of your recipes your set the result to the item wanted. In this way I imagine custom type of recipes, even if it implements the bukkit one they won't be needed to add them to the server recipe list. I can imagine this thing this way...

    EDIT: I don't know the crafting events really, I go and check them now...

    I found these:
    org.bukkit.event.inventory.CraftItemEvent
    org.bukkit.event.inventory.PrepareItemCraftEvent
     
    Last edited: Feb 15, 2015
  4. Offline

    SirMonkeyFood

Thread Status:
Not open for further replies.

Share This Page