Solved crafting recipe problem!

Discussion in 'Plugin Development' started by Taron10LP, Aug 20, 2019.

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

    Taron10LP

    Hi I have a problem!

    I want to create a new Item Stack with a recipe my code is:
    Code:
    //Lapis Element
            ItemStack lapiselement = new ItemStack(Material.INK_SACK, 1, (short) 4);
            ItemMeta meta = lapiselement.getItemMeta();
            meta.setDisplayName("§9§lLapiselement");
            ArrayList<String> lore = new ArrayList<>();
            lore.add(" ");
            lore.add(" ");
            lore.add("§7§lGEWÖHNLICH");
            lore.add("§l§7Stufe:§2X§7XXXX");
            meta.setLore(lore);
            lapiselement.setItemMeta(meta);
            lapiselement.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
            lapiselement.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
          
            ShapedRecipe leR = new ShapedRecipe(lapiselement);
            leR.shape(" 1 ", "111", " 1 ");
            leR.setIngredient('1', Material.INK_SACK, 4);
    
    this.getServer().addRecipe(leR);
    my problem is now it is like this:
    "0 1 0"
    "1 1 1" ------->number = stack amount
    "0 1 0"

    but I want to have i like this:
    "0 32 0"
    "32 32 32"
    "0 32 0"


    How do I do it like this? Pls answer!

    my 2. problem is if I do a special lapis block with my special lapis

    in a 3 x 3 field like a normal block is crafted
    out comes a normal lapis block, but I want to have a special one how do I do this?
     
    Last edited: Aug 20, 2019
  2. Offline

    robertlit

    Not possible as far as I know, you'll have to create a custom crafting table inventory. and then use:
    Inventory#getSlot(int i)#getAmount(). However that will change the whole code, it won't be as easy as getServer()#addRecipe();

    (If you took the idea from Hypixel skyblock, you will notice that they are using a custom inventory too and not the regular crafting table)
     
  3. So as far as I know you can't change the amount of the crafting ingredient (it is client side) you would have to take a look at the prepareItemCraftEvent.
    EDIT: also use this event for the second problem
     
  4. Offline

    Taron10LP

    Thank you verry much I'll create a custom crafting inventory!
     
Thread Status:
Not open for further replies.

Share This Page