# Question: How do you add objects to r188?

**URL:** <https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235>\
**Category:** Modding\
**Created:** [December 22, 2014, 9:20pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235 "2014-12-22T21:20:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomMartow](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TomMartow](https://discourse.stonehearth.net/u/TomMartow)\
**Post date:** [December 22, 2014, 9:20pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/1 "2014-12-22T21:20:02Z")

</div>

I know about the modelling, but I’m having trouble of adding an item into the game, does anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![Wombat85](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@Wombat85](https://discourse.stonehearth.net/u/Wombat85)\
**Post date:** [December 22, 2014, 11:52pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/2 "2014-12-22T23:52:01Z")

</div>

Whats the item? do you mean add a brand new item as in modding? or just adding an item like a table to the world?

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 23, 2014, 2:03am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/3 "2014-12-23T02:03:16Z")

</div>

Hi

Here’s the break down currently for r180, feel free to ask anyone if you have any more questions 😉

edit:  
I assumed craftable, if not let us know. World gen is somewhat similar, but still very doable at this point.

## Step 1 - Basic Setup

* * *

Goto your Stonehearth mods folder, if you installed to the default location this should be

x86 - 32bit  
_C:\Program Files\Steam\SteamApps\common\Stonehearth\mods_

x64 - 64 bit  
_C:\Program Files (x86)\Steam\SteamApps\common\Stonehearth\mods_

Now create a folder for your mod, for this example I’ll create a folder called **r180mod**.

Next create a file inside your mod folder, mine is **r180mod** , called **manifest.json**.  
Open your **manifest.json** , we will be using it in a little bit.

Now lets add you items files into our mod folder ( **r180mod** ).

For conventions sake, we add a “ **entities** ” folder, “ **entities** ” will be used to store all the files for items we add to the game. “ **entities** ” should be place just inside our **r180mod** folder.

Next add another folder for your mod item inside the **entities** folder. I will call mine “ **my\_mod\_item** ”.  
Now add any .qb files .png files that you’ve made for that item inside that folder.

Our mod file structure so far

```
- r180mod
  ----manifest.json
  ----entities
      ----my_mod_item
          ----my_mod_item.qb
          ----my_mod_item_iconic.qb
          ----my_mod_item.png

```

Let me break down the files I’ve added

**my\_mod\_item\_iconic.qb** - The stockpile version of my model, _I believe it’s 10x10x10_ voxels  
**my\_mod\_item.qb** - The actual fullsize model of my item  
**my\_mod\_item.png** - The picture displayed in the crafting window.

## Step 2 - Basic Manifest set up

* * *

Now lets go back to that **manifest.json** file, this file is used to tell Stonehearth many things about files you would like to it load, in particular we are concerned with the mixintos and aliases properties.

_mixinto_s - used to combine an existing file with another  
_aliases_ - allow us to give a simplified name for our mod item, just to simplify referencing it latter on.

Here is an example of a basic mod manifest

```
{
    "info" : {
          "name" : "r180mod",
          "version" : 1
    },
    "aliases" : {
    },
    "mixintos" : {
    }
}

```

You should copy and paste this to your **manifest.json**.  
_Just replace the “name” value with you mods folder name._

Lets add an alias for our mod item

```
{
    "info" : {
          "name" : "r180mod",
          "version" : 1
    },
    "aliases" : {
          "my_mod_item" : "file(entities/my_mod_item/my_mod_item.json)"
    },
    "mixintos" : {
    }
}

```

## Step 3 - Mixintos/Recipes

* * *

Next in order for your item to be craftable in the game, we must mixinto a classes recipe list. In order to do so we must have the files needed for the mixin and know where to mix into.

_Where_ - This depends on which class will crafting your item, all classes can be found in stonehearth/jobs  
_The Files_ - We will go over this together

Just follow along, I explain everything in the end.

Lets use the _carpenter_ for this example, lets create a new folder to hold all of our mixintos called **“mixins”** , place this inside **r180mod**.

Inside our **mixins** folder lets create a file called **“carpenter\_recipes.json”**.

Now step back to the **r180mod** folder and create another folder called " **recipes"** , inside this folder create another file called **“my\_mod\_item\_recipe.json”**.

**carpenter\_recipes.json** - Will be used to specify all of the recipes we’d like to add to carpenters current recipe list.  
**my\_mod\_item\_recipe.json** - Will be used to specify the acutally recipe for our item.

Our mod file structure so far

```
- r180mod
  ----manifest.json
  ----entities
      ----my_mod_item
          ----my_mod_item.qb
          ----my_mod_item_iconic.qb
          ----my_mod_item.png
  ----mixins -NEW
      ----carpenter_recipes.json -NEW
  ----recipes -NEW
      ----my_mod_item_recipe.json -NEW

```

Even though we have written anything lets update our manifest to tell Stonhearth that we’d like to mixin a file.

```
{
    "info" : {
          "name" : "r180mod",
          "version" : 1
    },
    "aliases" : {
          "my_mod_item" : "file(entities/my_mod_item/my_mod_item.json)"
    },
    "mixintos" : {
           "/stonehearth/jobs/carpenter/recipes/recipes.json" : 
              ["file(mixins/carpenter_recipes.json)"]
    }
}

```

mixintos are specified **target : file to add**

_/stonehearth/jobs/carpenter/recipes/recipes.json_ - The file that holds all the carpenter recipes.  
_[“file(mixins/carpenter\_recipes.json)”]_ - Our carpenter recipe file.

Lets set-up our carpenter\_recipes.json file now. Match yours to this, make any adjustment for differences in names.

```
{
   "craftable_recipes" : {
      "furniture" : {
         "recipes" : {
            "my_mod_item" : {
               "recipe" : "file(/recipes/my_mod_item_recipe.json)"
            }
         }
      }
   }
}

```

There are many catergories for where to add items, I chose _furniture_. Take a look at  
_stonehearth\jobs\carpenter\recipes\recipes.json_, if you like to use a different catagory, you can even add your own.

```
{
   "craftable_recipes" : {
      "$catagoryname" : {
         "ordinal" : 5, (5 and up I believe)
         "name" : "Display Name",
         "recipes" : {
            "my_mod_item" : {
               "recipe" : "file(/recipes/my_mod_item_recipe.json)"
            }
         }
      }
   }
}

```

With this out of the way, lets move on to our actual recipe. Open up **my\_mod\_item\_recipe.json**

```
{
   "type":"recipe",

   "work_units" : 3,
   "recipe_name" : "My Super Mod Item - Display Name",
   "description" : "Better than every item.",
   "flavor" : "Stonehearthians will think this line of text",
   "portrait" : "/r180mod/entities/my_mod_item/my_mod_item.png", 

   "ingredients": [
      {
         "uri" : "stonehearth:furniture:not_much_of_a_bed",
         "count" : 1
      },
      {
         "material" : "wood resource",
         "count" : 1
      }
  ],
  "produces": [
      {
         "item":"r180mod:my_mod_item"
      }
  ]
}

```

Lets break it down, I’ll go over only the ones that are not self explanitory.

**“work\_units” : 3** - How long to craft

**“ingredients”:** - This one’s a bit complicated, for each seperate ingredient you must specify { }'s, from here you have 2 options, require a specific item, or require that the item has a specific material tag.

**“produces”:** - specifies the return item from the crafting process

That should be good, final stretch 😉

## Step 4 - Entity\_Forms and Iconic/Ghost

* * *

In our manifest’s aliases we specified  
**_"my\_mod\_item" : "file(entities/my\_mod\_item/my\_mod\_item.json)"_**

Go ahead and create that file, along with it create 2 other files,

**my\_mod\_item\_iconic.json**  
**my\_mod\_item\_ghost.json**

Our mod file structure so far

```
- r180mod
  ----manifest.json
  ----entities
      ----my_mod_item
          ----my_mod_item.qb
          ----my_mod_item_iconic.qb
          ----my_mod_item.png
          ----my_mod_item.json - NEW
          ----my_mod_item_iconic.json - NEW
          ----my_mod_item_ghost.json - NEW
  ----mixins
      ----carpenter_recipes.json
  ----recipes
      ----my_mod_item_recipe.json

```

_For anything below rememeber to replace filenames/paths to match you own._  
For **my\_mod\_item.json**

```
{
   "type" : "entity",
   "mixins" : "file(my_mod_item_ghost.json)",

   "components": {
      "stonehearth:entity_forms" : {
         "iconic_form" : "file(my_mod_item_iconic.json)",
         "ghost_form" : "file(my_mod_item_ghost.json)",
         "placeable_on_ground" : true
      },
      "region_collision_shape": {
          "region": [
            {
               "min" : { "x" : -0.5, "y" : 0, "z" : -0.5 },
               "max" : { "x" : 1.5, "y" : 1, "z" : 1.5 }
            }
         ]
      }
   },
   "entity_data" : {
      "stonehearth:net_worth" : {
         "value_in_gold" : 30,
         "rarity" : "common",
         "shop_info" : {
            "buyable" : true,   
            "sellable" : true,
            "shopkeeper_level" : 1,
            "shopkeeper_type" : "caravan"
         }
      }
   }
}

```

Things to note, (if you need more specific info feel free to ask)

**“placeable\_on\_ground”** - There is also “placeable\_on\_walls”

**“entity\_data”** - _I am completely guessing_, is used by other entities, ie a bed specifies “stonehearth:bed” : {}, allows other entites, to know it’s a bed.

**“region\_collision\_shape”:** - bounds of the object, _I am guessing again_ but I think they are based on Stonehearth cube size which is 1 voxel. Hard to test, can’t micro.

Next up **my\_mod\_item\_ghost.json**

```
{
   "type": "entity",

   "components": {
      "model_variants": {
         "default": {
            "models": [
               "file(my_mod_item.qb)"
            ]
         }
      },
      "unit_info": {
         "name": "My Super Mod Item",
         "description": "Whoo wa weee wa",
         "icon" : "file(my_mod_item.png)"
      },
      "stonehearth:material" : {
         "tags" : "wood furniture crafted"
      },
      "mob" : {
         "model_origin" : { "x": 0, "y": 0, "z": 0 },
         "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
      }
   }
}

```

Notes

**“tags :”** - Change this to what ever you want  
**"model\_origin" :** - Used to create a display offset for the model, I haven’t test but thats what it should be. **“region\_origin” :** - I haven’t test but I would guess a position offset, ie .5 half the width of a StoneHearth cube size, which is 1 voxel. ie x .5, y 0, z .5 , centered in the xz plane.

Finally **my\_mod\_item\_iconic.json**

```
{
   "mixins": "stonehearth:mixins:item_properties",
   "type": "entity",
   "components": {
      "item" : {
         "category" : "furniture"
      },
      "model_variants": {
         "default": {
            "models": [
               "file(my_mod_item.qb)"
            ]
         }
      },
      "mob" : {
         "model_origin" : { "x": -0.05, "y": 0, "z": 0.05 }
      }
   }
}

```

Notes

**“category” : “furniture”** - I would guess this is used for sorting in stock piles

## Debugging Problems

* * *

We are only human, so we are bound to make mistakes. Here’s some tips

**Check the log**

C:\Program Files (x86)\Steam\SteamApps\common\Stonehearth\stonehearth.log  
it can detail whats going wrong, other’s can help you if you can’t understand it.

**Check your json file** , very very common mistakes happen here, ie a " , " where it does not belong

> **[The JSON Validator](https://jsonlint.com/)**
>
> JSONLint is the free online validator and reformatter tool for JSON, a lightweight data-interchange format.

Can verify any errors in you json files

**Typos and Wrong Paths**  
Keep naming conventions,

“comfy\_bed\_red”  
“comfy\_bed\_blue”  
“comfy\_bed\_green”

Don’t do this

“comfy\_red\_bed”  
“bed\_comfy\_blue”  
“green\_bed\_comfy”

Name things consistently, this helps identify typos and remember what you have named things.  
Goes without saying, but I figured I was mentioning common problems, this is one you will likely run into.

**Trolled by load game**

I have no idea what causes this, but it is very very frustrating. My only guess is that items ui info is somehow reliant on some of your save, that if you change an items display name, the save fails to recognize that the paths have changed, and just amuses it’s the same, causing to fail to find the path. Start a new game to make sure you’ve really done something wrong.

**Ask the community, people are always around and willing to help.**

Best of luck

---

<div class="post-metadata">

**Author:** ![TomMartow](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TomMartow](https://discourse.stonehearth.net/u/TomMartow)\
**Post date:** [December 23, 2014, 9:43am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/4 "2014-12-23T09:43:56Z")

</div>

Thank you very much for that, I will be reading that in detail tomorrow as I’m working today but I caught what you said about the top.

I have made more plant types, farmable and to be found spawned in the game world. I also have items that I want to be made by the carpenter and at the moment new types of roads (that can’t be walked on if possible.)

New tree’s that can hopefully be added to the spawn, all that jazz.

---

<div class="post-metadata">

**Author:** ![SteveAdamo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/steveadamo/32/13955_2.png) [@SteveAdamo](https://discourse.stonehearth.net/u/SteveAdamo)\
**Post date:** [December 23, 2014, 1:26pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/5 "2014-12-23T13:26:53Z")

</div>

> [@honestabelink](#):
>
> Here’s the break down currently for r180

wow, well done @honestabelink!! thanks for putting this together… should prove very useful to other budding modders…

**+5 internet points** to you my good man! 👍

---

<div class="post-metadata">

**Author:** ![Drotten](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/drotten/32/14200_2.png) [@Drotten](https://discourse.stonehearth.net/u/Drotten)\
**Post date:** [December 23, 2014, 3:08pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/6 "2014-12-23T15:08:01Z")

</div>

Very nice little guide, me likey!

Just want to point out that in the manifest, there is no requirement that [info.name](http://info.name) has the same name as the mod folder. You could write in whatever you want there, of course it should be the same as the mod folder. But if your folder is called “my\_mod\_r180” you can name it “My Mod r180” in [info.name](http://info.name).

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 24, 2014, 2:24am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/7 "2014-12-24T02:24:54Z")

</div>

> [@thomasbiggin](#):
>
> I have made more plant types, farmable and to be found spawned in the game world. I also have items that I want to be made by the carpenter and at the moment new types of roads (that can’t be walked on if possible.)
> 
> New tree’s that can hopefully be added to the spawn

Thanks for clarifying.

_ **From here on I will reference an onion as the crop I’m adding, my onion will also grow in the wild.** _

## Farmable Crops

* * *

We will cover world gen in the next section first lets get your plants into the game 😉

Lets go over what files you will need to add a new crop to the game. I will also go over optional choices you have.

.qb’s for each stage of growth for your crop, from little stem to fully grown, _optionally you can include a withered version_.  
I don’t believe there is a limit to amount of stages.

.png - This will be shown in the farming ui, where players pick the crop they want to grow.

.json - This will specify our crop entity, will provide info like, growth stages, growth rate, what is harvested.  
_Optionally I will go over making your crop placeable, this will require some additional json files_.

_.lua - Optionally, we can specify a script to control plant growth, but it’s not required for normal growth._

Now lets setup our file structure for the new crop and add all of the files we need.

In our **entities** folder create a new folder “ **crops** ”, then create another folder, I will call mine “ **onion** ”.

Inside **onion** folder, place all .qb’s you have that make up the crop, your .png for farming ui, and create **onion.json**.

```
- r180mod
  ----manifest.json
  ----entities
      ----crops - NEW
          ----onion - NEW
              ----onion.json - NEW
              ----onion.qb - NEW
              ----onion.qb - NEW
              ----onion.qb - NEW
              ----onion.png - NEW

```

Next lets add an alias for our crop to our manifest

```
"aliases" : {
          "onion:crop" : "file(entities/crops/onion/onion.json)"
},

```

Even though we haven’t made the file yet, lets add a mixinto to our manifest, this will be used to add our crop to the farmers plantable crops.

```
"mixintos" : {
       "/stonehearth/services/server/farming/data/initial_crops.json" : 
          ["file(mixins/farmer_crops.json)"]
}

```

Lets add that file now, goto the **mixins** folder, and create the file **“farmer\_crops.json”**.

Open up **farmer\_crops.json**.

```
{
    "stonehearth:kingdoms:ascendancy": [
        {
            "crop_type": "r180mod:onion:crop",
            "quantity": 5
        }
    ],
    "stonehearth:kingdoms:rayyas_children": [
        {
            "crop_type": "r180mod:onion:crop",
            "quantity": 5
        }
    ],
    "stonehearth:kingdoms:northern_alliance": [
        {
            "crop_type": "r180mod:onion:crop",
            "quantity": 5
        }
    ]
}

```

Just replace _r180mod:onion:crop_ with your alias.

With that done lets move onto the actual json, open up **onion .json**.

```
{
   "type": "entity", 
   "components": {
      "model_variants": {
         "default": {
            "models": [
               "file(onion_3.qb)"
            ]
         },
         "onion_1": {
            "models": [
               "file(onion_1.qb)"
            ]
         },
         "onion_2": {
            "models": [
              "file(onion_2.qb)"
            ]
         },
         "onion_3": {
            "models": [
               "file(onion_3.qb)"
            ]
         }
      },
      "render_info" : {
         "scale" : 0.13
      },
      "mob" : {
         "model_origin" : { "x": -0.05, "y": 0, "z": 0.05 }
      },
      "unit_info": {
         "name": "My Super Crop", 
         "description": "Fast-growning, and super nutritious crop.", 
         "icon" : "file(onion.png)"
      },
      "stonehearth:crop" : {
         "resource_pairings" : {
            "onion_3": "stonehearth:food:corn:amazing_corn_basket"
         }, 
         "harvest_threshhold" : "onion_3", 
         "plant_overlay_effect" : "/stonehearth/data/effects/plant_crop_overlay_effect/plant_crop_overlay_effect.json" 
      }, 
      "stonehearth:growing" : {
         "growth_period" : "1h",
         "growth_stages" : [
            {
               "model_name" : "onion_1",
               "name": "Not Super Yet", 
               "description": "Not high-stakes gambling."
            },
            {
               "model_name" : "onion_2",
               "name": "Better but Not Super", 
               "description": "Not edible yet!"
            },
            {
               "model_name" : "onion_3",
               "name": "My Super Crop", 
               "description": "Extremely satisfying to eat."
            }
         ]
      },
      "stonehearth:material" : {
         "tags" : "crop onion"
      }
   }
}

```

_This can be overwhelming to look at but it’s really not that bad._

**Let’s take a look at model\_variants**

* * *

```
"model_variants": {
     "default": { - VARIANT NAME
        "models": [ - MODELS KEY
           "file(onion.qb)" - OUR MODEL VALUE
        ]
     },

```

**model\_variants** is used to specify each stage of our plants growth, to add a new variant simply add a new **variant name** along with the **models** key, followed by a list of possible **files**. I’m guessing if you wanted you could specify multiple files per variant, that way all plants wont look the same at the same stage.

**Let’s take a look at stonehearth:crop**

* * *

```
  "stonehearth:crop" : {
         "resource_pairings" : {
            "onion_3": "stonehearth:food:corn:amazing_corn_basket"
         }, 
         "harvest_threshhold" : "onion_3", 
         "plant_overlay_effect" : "/stonehearth/data/effects/plant_crop_overlay_effect/plant_crop_overlay_effect.json" 
      }, 

```

Here we specify some information about harvesting our crop. I have specified my crop when haverested in stage _ **onion\_3** _ will return **“stonehearth:food:corn:amazing\_corn\_basket”**. You can specify any item you want here, you can also add multiple **resource\_pairings**. _Later on I will show how to make your crop ediable, and return an edible entity._

**“harvest\_threshhold”** - I am guessing, is the minimum stage for harvesting.

**Let’s take a look stonehearth:growing**

* * *

```
"stonehearth:growing" : {
     "growth_period" : "1h",
     "growth_stages" : [
        {
           "model_name" : "onion_1",
           "name": "Not Super Yet", 
           "description": "Not high-stakes gambling."
        },

```

Here we specify how long each stage takes to grow, ie 3 stages at 1h **growth\_period** = 3h fully grown. Along with display name and description for each stage. **growth\_stages.model\_name** should match your **model\_variant** names.

If you need to mess with the growing, add this right below **“growth\_period” : “1h”,** _create the lua file too._  
**“growth\_check\_script” : “file(onion.lua)”,**

```
local onion={}
function onion.growth_check(entity,target_growth_stage,growth_attempts)
   return target_growth_stage
end
return onion

```

Your lua file should implement this function, and return a number between 1 and your highest growth stage, _I am guessing again about the return_.

That should do it, see if your crop is available to the farmer, just a reminder the loading bug happens here too. If you are sure you have done things right, and it’s not working, try it in a new game.

## World Gen with EntityClusters

* * *

Entity clusters are simple way to have your plants spawn throughout the world, it is used, for example for the current flowers in the game. Along with other things like animal spawns.

Lets get to it 😉

We will need to specify a mixin to add our plant to the world gen. Even though we haven’t create the file lets go ahead and specify the mixinto. Also lets add an alias for the plant version of my onion, the plant version is the one that grows in the wild.

```
"aliases" : {
  "onion:plant" : "file(entities/plants/onion/onion.json)"
},

"mixintos" : {
  "/stonehearth/scenarios/scenario_index.json":
            ["file(mixins/plant_fields.json)"]
}

```

Lets create the folders and files we need now

Goto your **mixins** folder and create **plant\_fields.json**.  
Goto your **entities** folder, create a new folder called **plants** , then create another folder called **onion** ,finally create a new file called “ **onion.json** ”.

Our file structure so far

```
- r180mod
  ----manifest.json
  ----entities
      ----plants - NEW
          ----onion - NEW
              ----onion.json - NEW
 ----mixins
     ----plant_fields.json - NEW

```

Open up **plant\_fields.json**.

```
{
   "static" : {
      "scenarios" : [
         "file(/terrain/onion_field/onion_field.json)"
      ]
   }
}

```

This will add our plant field to the world gen, we are missing **onion\_field.json** , lets create it now and the containing folders.

Inside our mod folder create a new folder called **terrain** , create another folder called **onion\_field** , then create **onion\_field.json** , finally open **onion\_field.json**.

Our file structure so far

```
- r180mod
  ----manifest.json
  ----entities
      ----plants
          ----onion 
              ----onion.json
 ----mixins
     ----plant_fields.json
 ----terrain - NEW
     ----onion_field - NEW
         ----onion_field.json - NEW

```

Open up **onion\_field.json**

```
{
   "mixins" : "/stonehearth/scenarios/static/entity_cluster",
   "name" : "onion_field",
   "category" : "terrain", 
   "habitat_types" : ["plains"],
   "size" : {
      "width" : 3,
      "length" : 3
   },
   "weight" : 20,
   "habitat_types" : ["plains", "foothills"],

   "scenario_info" : {
      "entity_type" : ["r180mod:onion:plant"],
      "entity_footprint_length" : 1,
      "quantity" : {
         "min" : 1,
         "max" : 6
      }
   }
}

```

Mostly straight forward… besides

**habitat\_types** - plains, foothills, mountains, forest  
**weight** - higher value more likely to place over another with a lower weight.

Lets move on to **r180mod/entities/plants/onion.json** , open it up.

```
{
   "mixins": "stonehearth:mixins:plant", 
   "type" : "entity",
   "components" : {
      "mob" : {
         "mob_collision_type" : "clutter"
      },
      "unit_info" : {
         "name": "Wild onion", 
         "description": "This Onion is the Best."
      },
      "model_variants": {
         "default": {
            "models": [
               "file(onion.qb)"
            ]
         },
         "depleted": {
            "models": [
               "file(onion_harvested.qb)"
            ]
         }
      },
      "stonehearth:renewable_resource_node": {
         "resource": "stonehearth:resources:fiber:silkweed_bundle",
         "renewal_time" : "1h"
      }
   }
}

```

Things to note

If your plant does not re-grow, remove

```
 renewal_time" : "1h"
 "depleted": {
     "models": [
        "file(onion_harvested.qb)"
      ]
  }

```

My fully grown onion model was onion\_3.qb, you can reference it here too. _So not to duplicate files around._

```
 "default": {
     "models": [
        "file(/entities/crops/onion_3.qb)"
      ]
  }

```

That should be good, give it a try. 😉

## Side Notes

* * *

If you want your crop to do these three things

- grow in the wild
- be farmable
- be placeable

You must create a specific entity separate from the crop version and the plant version. This entity should match my example on how to add a craftable item, _just without the crafting part_, ie it should contain the **entity\_form** component, and specify both ghost and iconic forms, along with the material and mob components.

example  
entities/onion/onion.json - placeable  
entities/crop/onion/onion.json - crop  
entities/plants/onion/onion.json- wild plant

Next change the harvested return item from the crop and wild plant versions to return your placeable version. Don’t forget to alias your placeable version.

Whats left

- **Ediable Entities** - very straight forward, maybe I’ll have time for a quick post tommorrow, _I am sure by this point you won’t need such detailed posts, let me know though._
- **Custom Trees** - I know nothing about, I’ll look into it, _probably after New Years_
- **Unwalkable roads** - Design choice seems counter perductive and confusing for players, but I’ll leave you to your own creative style ;), though I am not sure it’s possible, I have no idea how roads work, I’ll look into it, _probably after New Years_

Best of luck

---

<div class="post-metadata">

**Author:** ![Wombat85](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@Wombat85](https://discourse.stonehearth.net/u/Wombat85)\
**Post date:** [December 24, 2014, 2:54am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/8 "2014-12-24T02:54:19Z")

</div>

Unwalkable roads could be cheated by just giving them a large collision box, same as a wall for example.

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 24, 2014, 4:45am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/9 "2014-12-24T04:45:24Z")

</div>

> [@Wombat85](#):
>
> Unwalkable roads could be cheated by just giving them a large collision box,

Looking quickly, this is seeming like a viable way, but would require overrides to lua files, maybe some js.

```
,
"movement_modifier_shape" : {
   "modifier" : -0.75
}

```

_slows them down 75% while walking on the road_

I don’t get why it does not _un-prioritize_ them from the pathfinder. Maybe it’s caused by Radiant assuming roads are always a speed benefit at this point, not actually taking into account the speed modifier value. Does anyone know where they pull the pathfinder weights from, or are they on the c++ side with the rest of the pathfinder?

---

<div class="post-metadata">

**Author:** ![Miturion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/miturion/32/43498_2.png) [@Miturion](https://discourse.stonehearth.net/u/Miturion)\
**Post date:** [December 24, 2014, 12:43pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/10 "2014-12-24T12:43:05Z")

</div>

Great guides @honestabelink👍

For the roads, have you tried a number above 1? Maybe the pathfinder tries to find a way through low numbers. 0,25 does make it lower also if it is multiplied.

---

<div class="post-metadata">

**Author:** ![TomMartow](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TomMartow](https://discourse.stonehearth.net/u/TomMartow)\
**Post date:** [December 24, 2014, 2:10pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/11 "2014-12-24T14:10:04Z")

</div>

Hey I’ve gone through your guide today, not the farming part just the craftable item part and I can’t see to get it into the carpenters craft menu. I’ve got two errors from the JSON checker if you don’t mind taking a look.  
[beehive.json pastebin][1]  
[manifest.json pastebin][2]

Maybe that’s the reason why it’s not showing up? I’ll double check my file structure again with your guide but I’m pretty sure I’ve got that right. Enjoy your christmas and we’ll carry on whenever anyones free if that’s okay.

Thanks again. [1]: [{ "type": "entity", "mixins": "file(beehive\_ghost.json)", "compon - Pastebin.com](http://pastebin.com/Y029eKeZ)  
[2]: [-beehive----manifest.json----entities----beehive----beehive.qb----beehive\_iconic - Pastebin.com](http://pastebin.com/bD5Re1Bq)

---

<div class="post-metadata">

**Author:** ![Miturion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/miturion/32/43498_2.png) [@Miturion](https://discourse.stonehearth.net/u/Miturion)\
**Post date:** [December 24, 2014, 5:36pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/12 "2014-12-24T17:36:55Z")

</div>

Well if the checker say it is wrong, it probably is 😄  
You have a comma too much in the beehive.json (line 8) after  
`placeable_on_ground": true`  
and some weird json write-up above your info in the manifest. Just what the json checker says. Remove those and you are probably fine 😊

---

<div class="post-metadata">

**Author:** ![TomMartow](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TomMartow](https://discourse.stonehearth.net/u/TomMartow)\
**Post date:** [December 24, 2014, 7:09pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/13 "2014-12-24T19:09:16Z")

</div>

OOOOOOOO It’s showing up now!

My problem was the comma and I removed all that ---- stuff which I thought was supposed to go into the manifest.json, it was just @honestabelink trying to visualize the directories for me.

Brilliant, thanks 😃

It was going so well until I tried to make the item.

[![](http://i.imgur.com/hX1Xml8.png) ](http://i.imgur.com/hX1Xml8.png)

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 24, 2014, 7:24pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/14 "2014-12-24T19:24:04Z")

</div>

Just to extend what @Miturion said,

**beehive.json**

replace your **_"stonehearth:entity\_forms":_** with this

```
    "stonehearth:entity_forms": {
        "iconic_form": "file(beehive_iconic.json)",
        "ghost_form": "file(beehive_ghost.json)",
        "placeable_on_ground": true
       
    }, 

```

You had an extra comma after “placeable\_on\_ground”: true.

**manifest.json**

remove this

```
-beehive----manifest.json----entities----beehive----beehive.qb----beehive_iconic.qb----beehive.png----beehive.json-NEW---- beehive_iconic.json-NEW----beehive_ghost.json-NEW----mixins----carpenter_recipes.json----recipes----beehive_recipe.json

```

This is not part of the JSON.

**JSON format rundown**

JSON works with a the idea of key value pairs, for example.

```
"key" : "value"

```

To start a json file we specify an array of keys, we do this by using,

```
{
}

```

_an array can be looked at like a list_

We can add key value pairs like so

```
{
     "key1" : "value1"
}

```

To specify another key value pair we add a comma to the previous line

```
{
     "key1" : "value1",
     "key2" : "value2"
}

```

Note **key1** ’s line ends with a comma.  
Note **key2** ’s line does not end in a comma as it is the last key value pair, in the array.

In certian situations keys may need to contain multiple values, in these cases we specify another array

```
{
     "key" : "value",
     "key2" : "value2",
     "key_multiple_values" : { 
            "key1" : "value1",
            "key2" : "value2"
     }
}

```

Same rules apply about commas, if we wanted to add another key value pair after **“key\_multiple\_values”**

```
{
     "key" : "value",
     "key2" : "value2",
     "key_multiple_values" : { 
            "key1" : "value1",
            "key2" : "value2"
     },
     "key4" : "value4"
}
```

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 24, 2014, 7:28pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/15 "2014-12-24T19:28:01Z")

</div>

your .qb is compressed, I believe Stonehearth will not load it. You’ll have to re-export your .qb’s with the compression checkbox un-checked.

edit also

**Z-axis** option to **‘Right handed’.**  
Enable **VisibilityMaskEncoding**

---

<div class="post-metadata">

**Author:** ![phector2004](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/phector2004/32/44268_2.png) [@phector2004](https://discourse.stonehearth.net/u/phector2004)\
**Post date:** [December 26, 2014, 3:58am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/16 "2014-12-26T03:58:19Z")

</div>

Finally! Got it on my fourth try. Thanks for this walkthrough! It gave me something to do to get through this food-coma!!

 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/2X/9/9b4a0751f8023bf37d7dd494b93ad5d0a087e21f.jpg)  
_I’m hoping that’s a **water pot** and not the carpenter’s spit bucket_ 😧

**NOTE:**  
In your example code, line 8 of _item.json_ has that extra comma. Anybody copying from your example will get the same error @thomasbiggin and myself were experiencing.

Thanks again, and Merry Christmas!

---

<div class="post-metadata">

**Author:** ![coasterspaul](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/coasterspaul/32/47876_2.png) [@coasterspaul](https://discourse.stonehearth.net/u/coasterspaul)\
**Post date:** [December 26, 2014, 4:16am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/17 "2014-12-26T04:16:39Z")

</div>

I remember when I entered Ludum Dare 31, the make-a-game-in-a-weekend thing. I created my level format in JSON, but I couldn’t get my parser to work. I spent hours and hours of my 48/72 hours on trying to make the thing work. Then I found out I had an extra comma, or was missing a comma, or something. **No wonder my JSON parser couldn’t work, if I was feeding it invalid JSON!** Short story short: I didn’t get my game finished on time.

**Moral of the story: _Always_ use a JSON validator before putting in your JSON. _Always._**

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 26, 2014, 4:56am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/18 "2014-12-26T04:56:51Z")

</div>

> [@phector2004](#):
>
> In your example code, line 8 of item.json has that extra comma

Thanks for the catch, 😉 fixed.

> [@coasterspaul](#):
>
> I spent hours and hours of my 48/72 hours on trying to make the thing work. Then I found out I had an extra comma, or was missing a comma, or something.

It’s funny how it’s always such little things we waste hours upon hours trying to solve. When I as implementing raycasting for StoneVox I failed to remember lwjgl flips the y plane, causing my ray to invert against the rotation of my camera. I sat there for hours and hours looking over and over my math, just to find all I had to do was multiple the camera look vector y by -1. 😒

---

<div class="post-metadata">

**Author:** ![TomMartow](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TomMartow](https://discourse.stonehearth.net/u/TomMartow)\
**Post date:** [December 26, 2014, 10:44am UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/19 "2014-12-26T10:44:05Z")

</div>

Hey Guys,

It’s brilliant to see my own models in the game, I can’t wait to get it out there and hopefully people will benefit from them. I do have some more questions though if you don’t mind asking.

As you can see in the picture below me, this is the full whammy beehive model that is used when placed on the ground, but my beehive\_iconic.qb is 10x10x10 but still displays the full model in the stockpile. I don’t know why?

[![](http://i.imgur.com/SqFopjF.png) ](http://i.imgur.com/SqFopjF.png)

This is the iconic version (exported)

[![](http://i.imgur.com/uVQ7MUs.png) ](http://i.imgur.com/uVQ7MUs.png)

The beehive object has a matrix of 30x30x30 in Qubicle so how would I get the center of the object to be placed where I click on the ground, What happens now is I click on the ground and instead of it being placed in the middle of where I click, it moves up and right 1 voxel and half.

---

<div class="post-metadata">

**Author:** ![honestabelink](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@honestabelink](https://discourse.stonehearth.net/u/honestabelink)\
**Post date:** [December 26, 2014, 2:11pm UTC](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/20 "2014-12-26T14:11:19Z")

</div>

It’s hard to say what going on without seeing any files, try this if you are still having trouble private message me your beehive.json beehive\_iconic.json

> [@thomasbiggin](#):
>
> but my beehive\_iconic.qb is 10x10x10 but still displays the full model in the stockpile. I don’t know why?

This would suggest to me that your beehive\_iconic.json might be referencing the full size model, if not try opening the iconic model in Quibicle, just to make sure the file is right. If the file is right I would then suggest taking a further look at your beehive.json, making sure iconic\_form is properly set.

> [@thomasbiggin](#):
>
> The beehive object has a matrix of 30x30x30 in Qubicle so how would I get the center of the object to be placed where I click on the ground, What happens now is I click on the ground and instead of it being placed in the middle of where I click, it moves up and right 1 voxel and half.

try this in your beehive\_iconic.json  
“model\_origin” : { “x”: -0.05, “y”: 0, “z”: 0.05 }

other than that, make sure that when you exported, your beehive should be at position -15,0,-15.

Looking good so far 😉

**Edit :**  
I don’t know this for a fact, I am guessing, I could go and test it, but here’s my thought process now.

In your beehive\_ghost.json we set “region\_origin” : { “x”: 0.5, “y”: 0, “z”: 0.5 }, ie half a cube offset.  
Since your model is 30x30x30, we export at -15,0,-15 to get it as close to center as the .qb file format will allow for. From here “region\_origin” : { “x”: 0.5, “y”: 0, “z”: 0.5 } does the final shift to get it centered.

[Next page](https://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235.md?page=2)
