From 296140210b541bcdf0ccf6b6e7272516e840dc4a Mon Sep 17 00:00:00 2001 From: nova-aryan Date: Fri, 21 Aug 2026 01:07:25 +0530 Subject: [PATCH] Add optional farm wait-for-growth behavior --- USAGE.md | 2 +- src/api/java/baritone/api/Settings.java | 6 ++++++ src/main/java/baritone/process/FarmProcess.java | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/USAGE.md b/USAGE.md index fe95dad9ab..93ed091afa 100644 --- a/USAGE.md +++ b/USAGE.md @@ -48,7 +48,7 @@ Commands in Baritone: - `build` to build a schematic. `build blah.schematic` will load `schematics/blah.schematic` and build it with the origin being your player feet. `build blah.schematic x y z` to set the origin. Any of those can be relative to your player (`~ 69 ~-420` would build at x=player x, y=69, z=player z-420). - `schematica` to build the schematic that is currently open in schematica - `tunnel` to dig and make a tunnel, 1x2. It will only deviate from the straight line if necessary such as to avoid lava. For a dumber tunnel that is really just cleararea, you can `tunnel 3 2 100`, to clear an area 3 high, 2 wide, and 100 deep. -- `farm` to automatically harvest, replant, or bone meal crops. Use `farm ` or `farm ` to limit the max distance from the starting point or a waypoint. +- `farm` to automatically harvest, replant, or bone meal crops. Use `farm ` or `farm ` to limit the max distance from the starting point or a waypoint. Set `farmWaitForGrowth` to `true` to keep farming active while nearby crops are immature. - `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120). - `explore x z` to explore the world from the origin of x,z. Leave out x and z to default to player feet. This will continually path towards the closest chunk to the origin that it's never seen before. `explorefilter filter.json` with optional invert can be used to load in a list of chunks to load. - `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start. diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 3f45f7ac59..8a4bd8284d 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -998,6 +998,12 @@ public final class Settings { */ public final Setting farmMaxScanSize = new Setting<>(256); + /** + * Keep the farm process active when crops are present but none are mature + * enough to harvest yet. Disabled by default to preserve legacy behavior. + */ + public final Setting farmWaitForGrowth = new Setting<>(false); + /** * When the cache scan gives less blocks than the maximum threshold (but still above zero), scan the main world too. *

diff --git a/src/main/java/baritone/process/FarmProcess.java b/src/main/java/baritone/process/FarmProcess.java index 05b893a276..b8cc59c614 100644 --- a/src/main/java/baritone/process/FarmProcess.java +++ b/src/main/java/baritone/process/FarmProcess.java @@ -225,6 +225,7 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { List bonemealable = new ArrayList<>(); List openSoulsand = new ArrayList<>(); List openLog = new ArrayList<>(); + boolean hasImmatureCrop = false; for (BlockPos pos : locations) { //check if the target block is out of range. if (range != 0 && pos.distSqr(center) > range * range) { @@ -258,6 +259,12 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { toBreak.add(pos); continue; } + for (Harvest harvest : Harvest.values()) { + if (harvest.block == state.getBlock()) { + hasImmatureCrop = true; + break; + } + } if (state.getBlock() instanceof BonemealableBlock) { BonemealableBlock ig = (BonemealableBlock) state.getBlock(); if (ig.isValidBonemealTarget(ctx.world(), pos, state, true) && ig.isBonemealSuccess(ctx.world(), ctx.world().random, pos, state)) { @@ -385,6 +392,9 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { } } if (goalz.isEmpty()) { + if (hasImmatureCrop && Baritone.settings().farmWaitForGrowth.value) { + return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); + } logDirect("Farm failed"); if (Baritone.settings().notificationOnFarmFail.value) { logNotification("Farm failed", true);