Guide:Making a recipe

From Starbounder - Starbound Wiki
Jump to: navigation, search

Welcome to the recipe guide

This guide aims to explain the inner workings of the .recipe files and how to make them.

The .recipe files are usually located in "recipes" folder in the unpacked assets.

Recipe JSON fields

{
  "input" : [  

    { 
      "item" : "simplemagammo", 
      "count" : 1,
      "parameters" : {
        "ammoCount" : 0
      } 
    },

    { "item" : "simplebulletammo", "count" : 10 }
  ],

  "duration" : 1.5,

  "output" : {
    "item" : "simplemagammo",
    "count" : 1,
    "parameters" : {
      "ammoCount" : 10
    }
  },

  "groups" : [ "plain", "consumables", "all" ]
}

Let's go over the JSON fields.

input
This field contains an array of JSON objects describing the components to be used in this recipe, formatted as follows
[{"item":"itemName","count":1,"parameters":{}},{"item":"someotheritemName","count":42,"parameters":{}]
"item" field has to be the same as the itemName of the desired item.
"count" field has to be an integer number.
"parameters" field can include a JSON object similar to the item file.
Note that "parameters" field is only useful if you want to have a pick of the items with same id, like the simplemagammo item in the example recipe. Majority of recipes do not include this field at all in the input items, same as the simplebulletammo item in the example recipe.
Also, you have to remember that unless the item has a buildscript that specifies the parameters of each particular item, they will be empty.
duration
This field specifies the time it takes to craft the item.
This field is completely optional, but it is useful to either make item crafting times disappear or force player to have a break.
output
This field contains a JSON object describing the item this recipe is used to craft, formatted as follows
{"item":"itemName","count":1,"parameters":{}}
"item" field has to be the same as the itemName of the desired item. Be aware that game uses this field to grant recipes to player - opening one recipe for the item opens them all.
"count" field has to be an integer number.
"parameters" field is optional, and can include a JSON object similar to item file, allowing you to change desired parameters of the output item, like changing level of a weapon with {"level":10} for example.
groups
This field contains an array of all the groups this recipe is a part of.
This field determines the crafting stations that the item can be crafted at.
For example, the "plain" group in the example makes the simplemagammo item craftable by hand and "consumables" group would include it in consumables tab in crafting interface, if hand crafting had one.
It is recommended to see how the existing recipes are set up with regards to the groups.

Unlocking the recipe in the game

There are three ways to go about unlocking the recipe for the player.

defaultBlueprints

The easiest and the most non-intrusive way is to add the item your blueprint crafts into the defaultBlueprints field in player.config.
To do that, you will need to make a patch file :
Use http://trinithis.awardspace.com/commentStripper/stripper.html to remove the comments
Use http://chbrown.github.io/rfc6902/ to make your patch - copy the comment-stripped player.config into both yellow and green fields on the top of the page, edit the green field to include your item in defaultBlueprints field.
Take the output of the blue field and save it as player.config.patch in the root folder of your mod. If you already have a player.config.patch, merge the contents.

learnBlueprintsOnPickup

Objects and Items can have a learnBlueprintsOnPickup field in their config, which must be formatted as follows
"learnBlueprintsOnPickup" : ["name of your item here","additional items can be added, separated by comma"]

Recipe item

To make the recipe accessible through drops, treasure or purchase from npc merchants, refer to the recipe as follows
itemname-recipe


Quick Navigation