Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <range>` or `farm <range> <waypoint>` to limit the max distance from the starting point or a waypoint.
- `farm` to automatically harvest, replant, or bone meal crops. Use `farm <range>` or `farm <range> <waypoint>` 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.
Expand Down
6 changes: 6 additions & 0 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,12 @@ public final class Settings {
*/
public final Setting<Integer> 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<Boolean> farmWaitForGrowth = new Setting<>(false);

/**
* When the cache scan gives less blocks than the maximum threshold (but still above zero), scan the main world too.
* <p>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/baritone/process/FarmProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
List<BlockPos> bonemealable = new ArrayList<>();
List<BlockPos> openSoulsand = new ArrayList<>();
List<BlockPos> 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) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down