A guide to crop modding

As I was creating a mod which includes some custom crops I thought I would spend some time helping others create mods by producing this simple guide to Modding Plants.
Firstly, Big thanks to @Wiese2007 for the tomato plant I have used in this guide, your BreweryMod helped my so much in working out how to mod plants and as a homage to you I have used your plant in this guide.
In this guide we will be creating the mod “tomplant” which adds the tomato plant from the BreweryMod to the game on its own
So lets look at the folder structure
image

Each crop has 3 basic states: the crop, a stored basket and a serving. I have also implement the seeds which allows you to add them to traders, although I will not go into detail on this but feel free to look at the Mod for more detail.
Now let’s look at the manifest in the root folder of your mod
image

The info section contains the name of your mod and the version of code your mod is compatible with, version 3 works with [A22.5]
Default_locale defines the information file that contain all the wording displayed in Stonehearth for your items
Aliases are the things you are defining. In this case the tomatoes
Mixintos are items you are appending to. In this case telling the program about the new crops you have added and defining them as available in the starting crops
Overrides are things you are replacing.
Now we will look at the tomato_crop found in entities/crops/tomato_crop

The crop has upto 12 different stages of growth the graphics for these stages are defined in the model_variants section
The mob section defines where the item will appear relative to its planting
The crop section defines when the crop can be harvested and when it is spoilt in the example tomato_4 is fully ripe and can be harvested to create a food type of tomoto_basket which we will look at in a later section. Tomato_12 is spoilt
In the growing section you define the growth time period and the stages of growth. For testing I would keep the time period short
The final section defines the name and description for the game catalogue the actual names displayed in the game are defined in the locales/en.json which we will look at later.
Now lets move onto the tomato_basket.json

As with the manifest we are appending to the games food_decay section. This example has two model variants the basket and a decayed version. Only one qb graphic file is used if you look at the carrot in the main stonehearth file you will see it uses a different graphic for the different states,
Once again the mob defines where it will appear when picked
The stacks section defines have many of the item can be placed in the same location
The food container defines how the item can be used in this example it’s a food type
The net-worth defines its tradability
And once again the catalogue defines how the game sees and describes your item.
Now lets look at the food item as a serving tomato_serving.json

This file defines the behaviour a basket after it has been picked up to be eaten. As before the mixins defines that we are adding it to the item_properties section of the game. The model_variants defines the graphics used. The item session defines the type of item and when happens when the citizen stops carting the item. The food section defines how the food should be eaten and how much satisfaction is gained and the quantity that is consumed. and finally the catalogue defines the item to the games catalogue.
Now we will look at the two items in the /services/server/farming/data Section
all_crops.json
image

This defines the crop to the games. Ordinal defines the order it is displayed in the games crop list and level_requirement defines the level a farmer needs to be in order to use the crop
initial_crops.json
image

This section defines to the game which kingdoms the seeds are available in

The final section we will look at is the /locales/on.json file

This file describes the wording used in the game and must match the folder structure and other items defined in the earlier sections. If you find your wording isn’t appearing in the game start here and then look back through your other json files for typos.

I hope the guide has been of use. Feel free to point out any mistake of adjustment I need to make.
Enjoy and Keep Modding.

tomplant.smod

9 Likes

Thank you! I’ll have to test this out with one of the ideas I had on the backburner (once I get through all the things I’m supposed to have finished by now).

hope it helps :slight_smile:

What a great guide @Thomas_Rippon! Well explained and i personally find great insights in the way you explain what the different parts are responsible for. I hope you make more guides like this on moding :sunny:

Thank you! :jubilant:

2 Likes

ohh just great!

just the thing that i need for next updates ^^

merci

2 Likes

reading the title again
Sorry, I’m having a week of bad title reading. Cuz for me at first it said “How to stop modding”.

3 Likes

Maybe veg modding or plant would have been better?

You need some sleep Mel :smiley: At least you catch your misreadings…

2 Likes

Nah, that’s just me.
(although “a guide to modding crops” would probably have no such issues)

3 Likes

You say that, but I can think of some ways to go wrong with that one if I were sleep deprived…and/or drunk enough

Should I start worrying now?

1 Like