Update modding docs
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
# Crops
|
||||
|
||||
A crop is a block with an `age` state, the base game's `bworld:crop` [component](components.md), and a seeds item that
|
||||
places it. Adding one takes no code.
|
||||
|
||||
Crops grow on Stardew Valley's clock with Minecraft's rules: every morning at 06:00, a crop whose farmland was watered
|
||||
the day before grows a day, then all farmland dries out. The crop shows the stage for how far along it is.
|
||||
`mods/farmersdelight` adds its cabbages, onions, tomatoes and rice this way.
|
||||
|
||||
## A Basic Crop
|
||||
|
||||
`blocks/cabbages.json`, with one texture per stage through [variants](states.md#variants):
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "farmersdelight:cabbages",
|
||||
"model": "engine:cross",
|
||||
"textures": { "cross": "farmersdelight:cabbages_stage0" },
|
||||
"variants": {
|
||||
"age=1": { "textures": { "cross": "farmersdelight:cabbages_stage1" } },
|
||||
"age=2": { "textures": { "cross": "farmersdelight:cabbages_stage2" } }
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": { "toughness": 0 },
|
||||
"item": false,
|
||||
"place_on": ["bworld:hoed_dirt"],
|
||||
"states": [{ "name": "age", "bits": 3, "default": 0 }],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 12,
|
||||
"stages": 8,
|
||||
"fertilizer": "bworld:bone_meal",
|
||||
"drops": {
|
||||
"young": "farmersdelight:cabbage_seeds",
|
||||
"mature": "farmersdelight:cabbage",
|
||||
"bonus": "farmersdelight:cabbage_seeds"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`"item": false` because players plant the seeds, not the crop. `items/cabbage_seeds.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "farmersdelight:cabbage_seeds",
|
||||
"texture": "farmersdelight:cabbage_seeds",
|
||||
"places": "farmersdelight:cabbages"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`place_on` keeps it on farmland, and it pops off when the farmland is dug up.
|
||||
|
||||
## Parameters
|
||||
|
||||
| Param | Meaning |
|
||||
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `days` | Watered mornings from planting to fully grown. |
|
||||
| `stages` | How many ages it shows, 0 to `stages - 1`, spread evenly over `days`. The `age` state must fit them. |
|
||||
| `drops` | What it drops when broken: `young` before it's grown, `mature` once it is, and `bonus`, 1 to 4 of an item when grown (Minecraft's 1 plus 3 tries at 57%, like wheat's seeds). `young` and `mature` can be one id or a list. |
|
||||
| `fertilizer` | An item that grows it a day right away when used on it, like bone meal. |
|
||||
| `water` | `"farmland"` (the default) needs watered farmland under it. `"always"` grows every morning. |
|
||||
| `regrow_days`, `harvest` | Right clicking it once grown picks it, dropping `harvest.item` (`count` is `[min, max]`), and it grows back after `regrow_days`. |
|
||||
| `upper` | `{ block, stages, supporting_age }`: its last stages grow a second block on top, see below. |
|
||||
| `leaves` | What the spot becomes when it's broken, like the water rice was planted in. |
|
||||
|
||||
## Harvesting By Hand
|
||||
|
||||
Tomatoes are picked instead of broken:
|
||||
|
||||
```json
|
||||
"bworld:crop": {
|
||||
"days": 11,
|
||||
"stages": 8,
|
||||
"regrow_days": 4,
|
||||
"harvest": { "item": "farmersdelight:tomato", "count": [1, 2] },
|
||||
"drops": {
|
||||
"young": "farmersdelight:tomato_seeds",
|
||||
"mature": ["farmersdelight:tomato", "farmersdelight:tomato_seeds"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Two Block Crops
|
||||
|
||||
Rice grows in water and, once it's tall enough, grows panicles on top. The crop stays at `supporting_age` while the top
|
||||
block goes through its own `stages`:
|
||||
|
||||
```json
|
||||
"place_in": ["bworld:water"],
|
||||
"place_on": ["bworld:dirt", "bworld:grass", "bworld:hoed_dirt"],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 6,
|
||||
"stages": 4,
|
||||
"water": "always",
|
||||
"upper": { "block": "farmersdelight:rice_panicles", "stages": 4, "supporting_age": 4 },
|
||||
"leaves": "bworld:water",
|
||||
"drops": { "young": "farmersdelight:rice", "mature": "farmersdelight:rice" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The top block uses `bworld:crop_top` with its own `stages` and `drops`. Breaking either half harvests the whole plant:
|
||||
|
||||
```json
|
||||
"components": {
|
||||
"bworld:crop_top": { "stages": 4, "drops": { "mature": "farmersdelight:rice_panicle" } }
|
||||
}
|
||||
```
|
||||
|
||||
Since water is `replaceable` and rice has `place_in`, players plant rice by clicking the water itself.
|
||||
Reference in New Issue
Block a user