From 6ba8e5ea5ba0cae53bbc353c84cdf4c118226029 Mon Sep 17 00:00:00 2001 From: 0xf8 <0xf8.dev@proton.me> Date: Thu, 8 Jun 2023 22:58:42 -0400 Subject: [PATCH] Add right-click auto replant setting (mod compat, pams harvest craft) --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/process/FarmProcess.java | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index a3e952c7..25640832 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -884,6 +884,11 @@ public final class Settings { */ public final Setting replantCrops = new Setting<>(true); + /** + * Right click crops, don't break + */ + public final Setting assumeAutoReplant = new Setting<>(false); + /** * Replant nether wart while farming. This setting only has an effect when replantCrops is also enabled */ diff --git a/src/main/java/baritone/process/FarmProcess.java b/src/main/java/baritone/process/FarmProcess.java index 0ef85f07..0c4bba32 100644 --- a/src/main/java/baritone/process/FarmProcess.java +++ b/src/main/java/baritone/process/FarmProcess.java @@ -235,9 +235,15 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro Optional rot = RotationUtils.reachable(ctx, pos); if (rot.isPresent() && isSafeToCancel) { baritone.getLookBehavior().updateTarget(rot.get(), true); - MovementHelper.switchToBestToolFor(ctx, ctx.world().getBlockState(pos)); - if (ctx.isLookingAt(pos)) { - baritone.getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true); + if (Baritone.settings().assumeAutoReplant.value) { + if (ctx.isLookingAt(pos)) { + baritone.getInputOverrideHandler().setInputForceState(Input.CLICK_RIGHT, true); + } + } else { + MovementHelper.switchToBestToolFor(ctx, ctx.world().getBlockState(pos)); + if (ctx.isLookingAt(pos)) { + baritone.getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true); + } } return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); }