# How do you add harvestable items?

**URL:** <https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593>\
**Category:** Modding\
**Created:** [February 18, 2015, 8:26pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593 "2015-02-18T20:26:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhaldak](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhaldak](https://discourse.stonehearth.net/u/Zhaldak)\
**Post date:** [February 18, 2015, 8:26pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/1 "2015-02-18T20:26:25Z")

</div>

Hey, I was looking around and couldn’t find a tutorial to add a new harvestable resource, which would be spawned in with the world like regular berry bushes. I basically want to change the color of the berry bushes to blue (Juniper Berries!) berries. So regulars & Junipers would spawn. Anyone know how?

---

<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:** [February 18, 2015, 8:31pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/2 "2015-02-18T20:31:58Z")

</div>

There’s a thread called something like “how to add an item to r188” that goes into detail over this.

---

<div class="post-metadata">

**Author:** ![RepeatPan](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/repeatpan/32/46418_2.png) [@RepeatPan](https://discourse.stonehearth.net/u/RepeatPan)\
**Post date:** [February 18, 2015, 10:27pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/3 "2015-02-18T22:27:22Z")

</div>

> [@Zhaldak](#):
>
> So regulars & Junipers would spawn. Anyone know how?

Shameless self-plug: [Jelly’s landscaper](https://github.com/Quit/jelly/wiki/Landscaper). In order to achieve such an effect, you need to override the landscaper, which jelly conveniently does for you. All you need to do is mixinto one of Jelly’s data indices.

---

<div class="post-metadata">

**Author:** ![Zhaldak](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhaldak](https://discourse.stonehearth.net/u/Zhaldak)\
**Post date:** [February 18, 2015, 11:32pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/4 "2015-02-18T23:32:03Z")

</div>

I love Jelly thank you @RepeatPan

---

<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:** [February 19, 2015, 7:12am UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/5 "2015-02-19T07:12:45Z")

</div>

> [@Zhaldak](#):
>
> I basically want to change the color of the berry bushes to blue (Juniper Berries!) berries. So regulars & Junipers would spawn.

Jelly is definitely a great solution for this… other than it. This would be my solution 😉

Create a custom component. `mixin` that component into the existing berry bushes. When that component starts up replace, by some % chance, the regular berry bush with your own.

The main thing that would be different between this and Jelly is that this way you would get great integration of your new berry bush right into the regular berry bush spawns. You’d see regular and Juniper berry bushes side by side. 🙂

This also could be extended then easily to include even more types of bushes, once again all spawning together, instead of separate patches.

* * *

All things aside… 😉

The base games offers a great way to spawn things throughout the world. While spawning is part of the problem… making the entity actually harvestable is another issue.

I have a sample which covers all of this

> Renewable Resource [r188]

> Adds harvestable bee hive, basically a berry bush example, which can be harvested to get edible honey.

> Adding recipes to carpenter  
> Adding entities  
> Renewable resource example  
> Food example

> Download - [https://drive.google.com/file/d/0BynmPA83eY4PWGJTMWtDWWR3RVk/view?usp=sharing](https://drive.google.com/file/d/0BynmPA83eY4PWGJTMWtDWWR3RVk/view?usp=sharing)

> Original Post - [Question: How do you add objects to r188?](http://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235)

Basically the issue comes down to the type of spawning you are looking for. The base game can easily spawn things using what have been deemed `scenarios`. These are used for various things, but in your case, I’d point out the flowers and animals throughout the world are spawned in this way, you could easily adapt a `scenario` to spawn in your enities.

The `scenario` technique also leaves room to customize the amount to spawn in, chance to spawn, and what “biome” to spawn in.

Good luck with your mod 🙂

---

<div class="post-metadata">

**Author:** ![Zhaldak](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhaldak](https://discourse.stonehearth.net/u/Zhaldak)\
**Post date:** [February 19, 2015, 8:34pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/6 "2015-02-19T20:34:48Z")

</div>

Thanks! But that bee hive thing… Is it a creating a spawned renewable source tutorial? Or is it a tutorial for getting your carpenter to craft a renewable source?

---

<div class="post-metadata">

**Author:** ![RepeatPan](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/repeatpan/32/46418_2.png) [@RepeatPan](https://discourse.stonehearth.net/u/RepeatPan)\
**Post date:** [February 19, 2015, 8:45pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/7 "2015-02-19T20:45:22Z")

</div>

Renewable resources are not much more than an entity with the renewable-resource component. The berry bush is a prime example of it in terms of what is required, the wild silk weed probably too.

---

<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:** [February 19, 2015, 9:43pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/8 "2015-02-19T21:43:41Z")

</div>

> [@Zhaldak](#):
>
> Is it a creating a spawned renewable source tutorial? Or is it a tutorial for getting your carpenter to craft a renewable source?

I covered the issues of spawning and being harvestable separately in my post.

- spawning

- making the entity actually harvestable

- Renewable Resource [r188]

- Take a look at the default berry bush code

Renewable Resource [r188] will show you how to create an entity that is harvestable and returns a “food” that can be eaten.

As for using scenarios to spawn stuff in…

_Escaped my mind last time I posted…_🙂

> [@\[Mod\] Colors Mod by Chimeforest](http://discourse.stonehearth.net/t/colors-mod-by-chimeforest-new-and-improved/8459):
>
> Hello everyone, I’m back! I present to you my new and completely fleshed out COLORS MOD smile Colors Mod - Base This Mod is a continuation of my Old [Colors Mod](http://discourse.stonehearth.net/t/colors-mod-by-chimeforest/5162). It adds many new colors to stonehearth, all gather-able from in game resources. It can also be used as a springboard for other, future, mods which use colors. See the [next post](http://discourse.stonehearth.net/t/colors-mod-by-chimeforest-new-and-improved/8459/2) for instructions on how to include colors in your mod. Features: 7 Colors to choose from (including “undyed”) Colored Dyes, Cloths, and Thread…

@chimeforest uses `scenarios` to spawn additional flowers throughout the world. This could be adapted to spawn the bushes.

Personally if it was me I’d go with my component idea for the spawning. In my mind I imagine that all different types of bushes spawn together in the same patch. 😉

But it’s your mod and you’ll need to choose the direction you’d like to go.

I actually have been working on Stonevox like everyday to some degree… _I kinda want to look at something else_ 🙂

If you’d like me to I’ll write the lua component to do the spawning.

---

<div class="post-metadata">

**Author:** ![Zhaldak](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhaldak](https://discourse.stonehearth.net/u/Zhaldak)\
**Post date:** [February 20, 2015, 4:47pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/9 "2015-02-20T16:47:17Z")

</div>

If you could dude, that would be really great. I’m trying to figure this out but it’s getting kind of confusing so… That’d be a huge help man.

---

<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:** [February 20, 2015, 9:38pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/10 "2015-02-20T21:38:05Z")

</div>

![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/8/c/8c5ceda055eca92405a6ee30dbf5f5ca38d1eace.png)

> **[extra\_berry\_bushes.zip](https://drive.google.com/file/d/0BynmPA83eY4PMzlmakpVMDJab1U/view?usp=sharing)**
>
> Google Drive file.

There you go… 🙂

I like this type of spawning it looks very natural…

Basically here’s what I did

- implemented my own berry bush,basket,food\_serving
- created a custom component that allows for replacing an entity with another by chance
- added my component to the base berry bush
  - set it up to have a 50% percent chance to be replaced with a _Juniper bush_

Here’s how to use the component…

You can either specify it in an entities normal `.json` declaration or mixin it.  
To modify the game’s berry bush, you’d have to go the mixin route.  
Here’s what the mixin looks like…

```
{
	"components" : {  
		"extra_berry_bushes:entity_replace" : { 
			"berry_bush" : {  
				"chance" : "50", 
				"alias" : 
                                    "extra_berry_bushes:plants:juniper_berry_bush"
			}
		}
	}
}

```

`components` : we are adding into the components list

`extra_berry_bushes:entity_replace` : specify the component to add

`berry_bush` anything can go here, it’s just a name  
`chance` : replaced with chance 50%  
`alias` : alias to entity to replace with

Additional candidates to replace the main entity with can be added like so

```
{
	"components" : {
		"extra_berry_bushes:entity_replace" : {
			"berry_bush" : {
				"chance" : "50",
				"alias" :
                                    "extra_berry_bushes:plants:juniper_berry_bush"
			},
			"somethingelse" : {
				"chance" : "65",
				"alias" : "stonehearth:resources:wood:oak_log"
			}
		}
	}
}

```

That is all there is too it 🙂  
Now it’s up to you to adjust things… and maybe add some more bushes 😉

If there is any part of the mod you don’t understand or anything let us know… 😉

_P.S this was a bit more hacky then I would have liked but whatever… modding is modding…_

---

<div class="post-metadata">

**Author:** ![Zhaldak](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhaldak](https://discourse.stonehearth.net/u/Zhaldak)\
**Post date:** [February 21, 2015, 1:31pm UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/11 "2015-02-21T13:31:20Z")

</div>

I think I got it now, gonna add loads more and create a ‘Berry Mod’ so they don’t complain about eating the same berries anymore. Just curious… the:  
}  
}  
}

Line thingy, is it important to the code or can I just ignore it and add my stuff?

---

<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:** [February 22, 2015, 2:47am UTC](https://discourse.stonehearth.net/t/how-do-you-add-harvestable-items/10593/12 "2015-02-22T02:47:08Z")

</div>

> [@Zhaldak](#):
>
> is it important to the code or can I just ignore it and add my stuff?

Yes, it is important.

the `}` are part of how .json’s are written… if you write a `.json` wrong SH will not load it causing all sorts of problems for your mod.

_this post here i give a basic rundown how .json’s work and are written_ 😉  
… [Question: How do you add objects to r188? - #14 by honestabelink](http://discourse.stonehearth.net/t/question-how-do-you-add-objects-to-r188/9235/14)

_as a side note…_  
It is very common to make mistakes when writing `.json'`s.  
I use [http://jsonlint.com/](http://jsonlint.com/) to help me find the error’s. 😉
