AI Players
Type to search documentation.

Building an economy

Farming and animals

How bots grow crops, keep a pen of animals, fish, and turn it all into food.

Once a bot has a base, hunting for every meal gets old. So it starts a farm: a field of crops and a pen of animals, right inside its base.

The crop field

The first plot comes the day the bot arrives. Once it holds its stone tools and has seeds or knows grass to break for them, it sows a small 5×5 plot for food, before the iron of its next tools and its mine, since wheat takes days to ripen. A bot with no base yet sows it beside the site it chose for its house, before the walls, and the wheat grows while the house goes up (that plot founds the base there). Without a bucket the plot goes by the nearest water the bot knows, and when that pond’s surface lies level with the plot’s floor the bot cuts a channel of up to six blocks from the pond to the center, so every tile grows like a watered one. Once started, the plot is built and sown in one go, and only a fight or the night takes the bot off it.

Later fields are 9×9 plots, built like a player would:

  1. It levels the ground and digs a hole in the middle, then fills it from a water bucket (once it has the iron to make one). Without a bucket, it builds the field next to water, or as a dry field as a last resort.
  2. It puts a torch on each corner, so the crops keep growing at night and nothing spawns in the field.
  3. It tills and sows every tile one by one, with a hoe. It plants as soon as it tills, so the farmland never dries back into dirt.
  4. When a crop is ripe, the bot harvests it and replants right away.

The first seeds come from breaking grass, and every harvest brings more. Bots grow wheat, carrots, potatoes and beetroot, and bake bread from their wheat. When the first field is fully planted and the bot still wants more crops, it starts a second one.

Bots clear flowers and fix sand on their tiles. They leave alone anything a player put there, like a chest, a sign or a furnace.

Bone meal

Wheat takes most of a day to grow, so a bot bone-meals its first crops like a player would. While its crop stock or its food is short and it holds bone meal (or bones to make it from, three meal a bone), each visit to the plot uses one bone meal on every crop that isn’t ripe yet. The bot clicks each one from beside the tile and harvests whatever the meal ripened right away.

The bones come from skeletons. While a plot stands and the crop stock is short, the dusk hunt at the door that brings a bow’s string and arrows also stays out for up to 16 bones. A stack of bones and a stack of bone meal stay in the bot’s pockets while a farm plot stands. Nether wart, saplings and grass are never mealed.

The animal pen

Once a bot has seen a pair of one of its style’s animals together (a cow, a sheep, a pig or a chicken by default) and holds their food (or knows grass to break for seeds, for chickens), that pair is its herd. It builds a 7×7 pen next to its house, a ring of fences with one gate, and leads the two in the same day, ahead of its house and its next tools. Then:

  • Leading animals in: it walks up holding wheat, and the cow follows it into the pen, just like it would follow you. If the animal lags behind, the bot stops and waits.
  • Breeding: it feeds two animals to make a baby, taking the food from its pockets or its chests.
  • Food: when food runs short and there are more than two animals of a kind, it slaughters the extras, keeping a breeding pair.
  • Closing up: it shuts the gate behind itself whenever it walks in or out.

Bots never touch an animal with a name tag or on a lead. While a farming bot is still building its herd, it also spares wild animals of the same kind, unless it’s hungry.

Sheep and the bed

A style whose farm.animals lists minecraft:sheep pens a pair and shears them for the bed’s wool. It does this while its house has no bed and it holds fewer than three wool of one color, with shears in hand (or two iron ingots to spare, which it makes into shears first). Once two sheep stand in the pen, it walks in, shears every sheep with wool, picks the wool up and walks out, shutting the gate. No shipped style pens sheep, but every bot still goes looking for wild sheep for its bed (the bed comes within a day).

Fishing

A bot whose house stands goes fishing when there’s water near home, with a real rod in its own hand. It walks to a bank of open water (three blocks of water in a line, open to the sky) inside its yard or within 16 blocks of its door. Then it casts, waits for a bite, reels in the moment the bobber dips and takes what comes up.

It fishes for food when no animal is about, and for the experience while it has an enchanting table and is below level 30. A bank inside the yard is safe ground, so fishing is a favorite night job. A run ends after 64 casts or once the food stock is met. The rod takes three sticks and two string (the spiders at its door at dusk bring the string). The bot replaces it before it wears out and never stows it.

After its casts, the bot sorts the catch. It throws away the junk (lily pads, bowls, ink sacs, tripwire hooks, rotten flesh, bamboo, leather boots, pufferfish), cooks the fish and stows the surplus with the food, and keeps the treasure (an enchanted book, a bow, a rod) in hand.

Nether wart

A bot whose play style stocks or hoards nether wart (for brewing potions) also builds a 5×5 wart bed of soul sand next to its crop fields. It does this once it brings soul sand and nether wart back from a Nether fortress. It plants the wart straight on the soul sand (no water, hoe or torches needed), harvests ripe wart and replants each tile right away.

Sugar cane and leather for bookshelves

Once a bot reaches diamond tools and sets up an enchanting corner, it needs paper and leather for up to 15 bookshelves. For the paper, it keeps 16 sugar cane cut from the riverside where it grows (above the root, so the cane grows back). The leather for the books comes from the cows it hunts or from slaughtering animals in the pen.

Food all year round

The harvest goes into the base’s chests. Any raw meat from hunting or from slaughtering extra animals gets cooked in a furnace first. Bots keep up to 64 hunger points of their best cooked or farmed food in their pockets, and bake bread from their wheat. A bot with a pen also keeps some of its animals’ food (wheat for cows) on hand, so it’s always ready to lead and breed. A hungry bot with no animal in sight also takes the food that grows wild (a jungle’s melons, a taiga’s ripe sweet berries), and when its hunt finds nothing at all, its farm and its fishing come before its tools and its mine until it sees an animal again (keeping stock).

Technical details

Farming settings in the play style

Every key is optional. These are the defaults, which every shipped play style uses:

playstyle.json (excerpt)
"farm": {
"crops": ["minecraft:wheat_seeds", "minecraft:carrot", "minecraft:potato", "minecraft:beetroot_seeds"],
"animals": ["minecraft:cow", "minecraft:sheep", "minecraft:pig", "minecraft:chicken"],
"plots": 2,
"stock": { "minecraft:wheat": 32 }
}
  • crops: planting items in order of preference. The first is the one the bot goes looking for; the others are planted when it has them. minecraft:nether_wart is also accepted and goes on the 5×5 soul sand wart plot; stem crops (melons, pumpkins) aren’t supported in farm.crops yet. A mod’s crop needs no plugin: a block in #minecraft:crops with an age and no half is sown, harvested at its last age and replanted with the item that places it.
  • animals: the animal types the pen holds.
  • plots: how many 9×9 crop fields a base may have (1 to 4; the wart plot is separate).
  • stock: how many crops to keep, in the bot’s pockets and the base’s chests together. Listing minecraft:nether_wart here (or in hoard) makes the bot build and tend a wart plot. Listing minecraft:bone_meal sets how much meal the bot makes from its bones before a visit, when that’s more than its young crops need (no plot grows it, so it never asks for more crops).

See Play style files.

Herd and food details
  • Bread costs three wheat. A bot keeps eight of its herd’s food in hand while a pen stands. It never cooks or stows the crops it plants (like seed potatoes) from its hand, so the field can always replant.
  • It slaughters animals of a type down to two, and only when food is short, cooking the raw meat at a furnace before eating or stowing.
  • It spares wild animals of its herd’s types until two are penned, unless it’s hungry.
  • Only one field and one pen are built at a time per faction, and a base has a single pen and at most one wart plot.
  • Shears are made from two iron ingots once an iron pickaxe is held; a named or leashed sheep, or one in another base’s pen, is never shorn.
Fishing in detail

fish is an objective of the gather family. It scores half the food stock’s shortfall (the raw catch counted at its cooked worth) or a fixed 0.1 while a table stands and the level is under 30, whichever is more. A tie with the food hunt goes to the hunt. The stand is read from the water the bot perceives, so water near home isn’t seen from far away. A homeless bot never fishes. The bite is read the way a player sees it (the bobber’s dip). A cast that lands out of water is a miss, three in a row fail the run for a while, and a bobber with no bite in 1500 ticks is cast again. At night the cook and the stow happen only with what the bot has at home. Otherwise the raw fish waits in hand for the day. A worn rod counts as missing and is remade like a tool.

Inspecting a farm

/aiplayer info <bot> shows the farm on its farm: line (fields, wart plot 5x5, and pen). Operators can drive farming by hand with /aiplayer debug <bot> task tend (which bone-meals as the objective does), task pen minecraft:cow, task breed minecraft:cow, task build farm, task build wart_plot and task build pen, and fishing with /aiplayer debug <bot> objective fish. See Inspecting and debugging bots.

Known limits
  • One pen and one wart plot per base.
  • Bots only pen animals they’ve seen (a pair together); they don’t go searching for a herd.
  • No melon or pumpkin stems or cocoa pods yet, and no composting.
  • A style with no bow, or one that already has its bow and arrows, runs no dusk hunt, so its farm gets bones only from the skeletons its fights happen to kill.
  • Vanilla’s bite is random (5 to 30 seconds), so 64 casts can be a long night. There are no AFK fish farms and no fishing from a boat.

Last updated Nov 9, 2026