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

How Are Item Recipes Generated/Maintained? (recipes.json)

Discussion in 'General discussion' started by MK500, Dec 23, 2016.

  1. MK500

    MK500 Slime

    Messages:
    77
    GitHub:
    markkrueg
    A few months back I made it my mission to add as many recipes as possible to a certain spoon via pull requests. Since I have limited PHP coding abilities; but good technical skills, I thought this was a good way to contribute. I tested crafting each item in MCPE single player, adjusted the recipe code in CraftingManager.php (matching the existing coding style), and then tested thoroughly before making each pull request.

    I thought I might try the same on PMMP, but am unfamiliar with the new recipes.json method. Can anyone walk me through how the recipes.json file is created/maintained? Is it automatically generated from a decode of the MCPE client? Is it built using some magical tools by gurun? Has it been built by hand (if so, is there a recommended JSON editor)?

    Thanks for any info on this. I hope I can be of help to the project.
     
  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
  3. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    It's very simple.

    Types:
    • 0: Shapeless Recipe that can't be crafted
    • 1: A Crafting Table Recipe
    • 2-3: A Furnace Recipe
    Width: The amount of horizontal items the crafting table takes. Max is 3 because crafting table only has 3 horizontal slots.
    Height: The amount of vertical items the crafting table takes. Max is 3 because crafting table only has 3 vertical slots.

    Input is the items it takes to craft the recipe only for Shaped Recipes or Furnace Recipe. THE ORDER of the recipe goes from RIGHT TO LEFT, it DOES NOT go from top to bottom.
    The format:
    • id: the id of the item(s) it requires in order to craft the output item.
    • damage: the damage/meta the item needs to have, but a item that can be used to craft does not take damage so it will stay as '0'.
    • count: the amount of the item(s) in a single slot that it requires to craft the output item.
    • nbt: I really don't know, probably some NTB tags.
    For example a diamond sword:
    [​IMG]

    If you understood what I just explained, you might understand how the diamond sword or any other recipe works. Here's the diamond sword recipe: https://github.com/pmmp/PocketMine-...0/src/pocketmine/resources/recipes.json#L1185

    Finally, the output:
    About the uuid , no idea. You might wanna ask someone else.
     
    Primus, MK500 and robske_110 (Tim) like this.
  4. MK500

    MK500 Slime

    Messages:
    77
    GitHub:
    markkrueg
    Thank you so much xBeastMode! I really appreciate all the time you took to post the details!

    I may need to use wireshark or similar to figure out the UUID.

    I will experiment and report back.

    I guess the only question I have left is: How was the recipes.json originally generated? If there is some automation that does this, then it would be pointless for me to make pull requests for fixes (because it would just be replaced in mass). If it was built manually then I can help manually fix it.
     
    Last edited: Dec 23, 2016
  5. MK500

    MK500 Slime

    Messages:
    77
    GitHub:
    markkrueg
    Apparently the recipes.json file IS generated automatically; so I will hold off on working on this by hand. I had been busy working on other things anyway; so was happily surprised by dktapps commit today :)

    See Commit 736ec6e
     
    jasonwynn10 likes this.
  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.