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

Solved Create Custom Crafting Recipe

Discussion in 'Development' started by Bintang Putra, Jun 11, 2017.

  1. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Hi, I want to make a custom crafting recipe that require custom items with name
    I'm making an rpg plugins, and want to add crafting feature on my plugins, so player can craft RPG items from the crafting table.

    is it possible? if yes, can you make an example of it?

    Thanks :D
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    theoretically possible using names would be a big implication as players could rename things Or you would have to disable renaming...
    i am not sure but maybe NBT works if PMMP does deep compare
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    It is possible, but can you show proof of a previous attempt?
     
  4. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    i'm not making the custom crafting recipe yet.
    but the rpg, i already made it
     
  5. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Teamblocket and jasonwynn10 like this.
  6. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
  7. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    So Shapeless recipe is a recipe that require another item but with no shape?
    PHP:
    $recipe = new ShapelessRecipe(Item::get(28611$nbt));
    $recipe->addIngredient($x$yItem $item);
    What are $x, $y on AddIngredient
     
  8. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Did i do it right?
    PHP:
    $recipe = new ShapelessRecipe(Item::get(28611));
    $recipe->addIngredient($x$yItem::get(27611));
    $this->getServer()->getCraftingManager()->registerShapelessRecipe($recipe);
     
  9. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Code:
    [08:47:14] [Server thread/CRITICAL]: Error: "Call to a member function toBinary() on null" (EXCEPTION) in "/src/pocketmine/inventory/CraftingManager" at line 218
    
    i dont know what to do :(

    PHP:
    $recipe = new ShapelessRecipe(Item::get(28611));
    $recipe->addIngredient(Item::get(27611));
    $recipe->addIngredient(Item::get(27611));

    $this->getServer()->getCraftingManager()->registerShapelessRecipe($recipe);
     
  10. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    i don't know if am right or wrong but i suppose since your making a new recipe you need another file with the recipe blocks etc?
     
  11. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    how to get the recipe blocks file?
     
  12. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    NVM Solved With
    PHP:
    registerRecipe($recipe);
    idk why registerShapelessRecipe() Doesnt work :/
     
  13. Husk

    Husk Creeper

    Messages:
    1
    GitHub:
    huskdeveloper
    Use:

    PHP:
    $recipe = new ShapelessRecipe(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->registerToCraftingManager();
     
    kazuya likes this.
  14. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    PHP:
    $recipe = new ShapelessRecipe(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $recipe->addIngredient(Item::get(1,0,1));
    $this->getServer()->getCraftingManager()->registerRecipe($recipe)
    It worked,
    but when i try to craft it from crafting table, the items goes back
     
  15. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    ShapelessRecipe is for the 2x2 crafting window. If you are looking to use more than 4 items, you need to use BigShapelessRecipe
     
  16. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Tried, i think its a bug from pmmp, cause i cant craft anything, even a wood planks
     
  17. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    did you make sure to set the Id ?
     
    A354-PH likes this.
  18. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    yep, its already working.

    its just because i can't craft anything.
     
  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.