Skip to main content

How to make a crop

Crop elements let you create new crop blocks and add them to your mod. This is for crops that are similar to wheat, potatoes, carrots, etc. in that they grow in tilled dirt (farmland), and use a seed item.

Tomatoes

General properties

PropertyDescription
In game nameThis is what will be displayed in the game for this block's name.

Growth stages

The growth stages section is used to define each of the visual growth stages for the crop block. You can add as many growth stages as you like, but the minimum is 2. Using bonemeal or waiting for time to elapse will trigger the crop block to grow through its stages.

Tomato Growth Stages

Items

The item section lets you select a seed item for the crop. This is the item that will be used to plant the crop block on farmland.

Tomato Seed Item

Loot

In order for your crop to drop any items (the crop item itself like a tomato) and seeds, it needs an associated loot table. A loot table that has already been added can be assigned to the crop block here.

Below is an example loot table that I used for my Tomato crop. It is modified from the wheat loot table. You'll notice that the block property is set to project_name:crop_block_name. Additionally, we must set the age condition for each of the drops. This is so that the crop only drops the tomato when it is age three. My tomato crop has four stages, 0 through 3. For that reason, 3 is the fully-grown stage.

I also modified the loot table to drop project_name:tomato_seeds instead of normal wheat seeds.

{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "with_crops:tomato_crop",
"properties": {
"age": "3"
}
}
],
"name": "with_crops:tomato"
},
{
"type": "minecraft:item",
"name": "with_crops:tomato_seeds"
}
]
}
]
},
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "with_crops:tomato_seeds"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "with_crops:tomato_crop",
"properties": {
"age": "3"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

You can read more useful information about the general loot table formatting here.