1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How to use ShapedRecipe to add custom craftings?

Discussion in 'Development' started by OguzhanUmutlu, Jan 5, 2021.

  1. OguzhanUmutlu

    OguzhanUmutlu Witch

    Messages:
    63
    GitHub:
    OguzhanUmutlu
    How to use ShapedRecipe to add custom craftings?
     
    Last edited: Jan 6, 2021
  2. royal

    royal Creeper

    Messages:
    1
    GitHub:
    royaljacques
    $item = Item::get(Item::STICK, 0, 1);
    $item->setCustomName("STICK");
    $itemName = new ShapedRecipe(
    [


    // EXAMPLE OF CRAFT
    " A ",
    " A ",
    " B "
    ],
    [


    // HERE YOU PUT
    // "A" => Item::get(id, meta, count),
    // ETC ETC
    "A"=>Item::get(Item::DIRT, 0, 1),
    "B"=>Item::get(Item::COBBLESTONE, 0, 1)
    ],
    [$item]
    );
    $itemName->registerToCraftingManager(Server::getInstance()->getCraftingManager());
     
    OguzhanUmutlu likes this.
  3. OguzhanUmutlu

    OguzhanUmutlu Witch

    Messages:
    63
    GitHub:
    OguzhanUmutlu
    thx
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.