Farm crops
API 4 can express bounded patch harvesting now. Continuous row farming with an exact heading, held movement, turns, inventory recovery, and stop policy needs a dedicated action that is absent from the current registry.
Harvest a patch
The Test Wheat lab uses this composition:
- Find nearby crop blocks.
- Group them into a patch.
- Read route zones when the farm has known bounds.
- Navigate to a standoff near the patch.
- Run
mining.mine_areaagainst the patch box. - Observe again before choosing the next patch.
local found = hexis.world.blocks.find({
radius = 12,
selector = {block_ids = {"minecraft:wheat"}},
limit = 32,
})
local arrived = hexis.await(hexis.navigate.to({
destination = {x = 12, y = 70, z = -8},
arrive_within = 2.5,
}), {timeout = 60})
if arrived.ok then
hexis.await(hexis.mining.mine_area({
world_generation = found.world_generation,
area = {
kind = "box",
min = {x = 8, y = 69, z = -12},
max = {x = 16, y = 72, z = -4},
},
blocks = {priorities = {["minecraft:wheat"] = 100}},
held = {name_patterns = {"Hoe"}},
maximum_blocks = 64,
}), {timeout = 120})
end
This uses the mining engine because the bounded task is still “break matching blocks in this place.” The author-facing guide remains farming because that is the user's goal.
What is not available
There is no public API 4 member for:
- setting an exact yaw or pitch;
- holding a fixed farming row continuously;
- turning between rows;
- detecting crop regrowth as a row policy;
- selling or inventory-full recovery as a farming task.
Do not borrow old camera or movement calls. A future row-farming action should own continuous movement and camera control as one bounded task.