From f09f1e7f851a4f5286bd209bbc88e097c65eb1cb Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Sat, 12 Jun 2021 15:04:36 +0100 Subject: [PATCH 1/2] Make farm use inventory when allowInventory is enabled. --- .../baritone/behavior/InventoryBehavior.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/baritone/behavior/InventoryBehavior.java b/src/main/java/baritone/behavior/InventoryBehavior.java index 22ef3a64..3741b088 100644 --- a/src/main/java/baritone/behavior/InventoryBehavior.java +++ b/src/main/java/baritone/behavior/InventoryBehavior.java @@ -18,6 +18,7 @@ package baritone.behavior; import baritone.Baritone; +import baritone.api.BaritoneAPI; import baritone.api.event.events.TickEvent; import baritone.utils.ToolSet; import net.minecraft.block.Block; @@ -152,6 +153,10 @@ public final class InventoryBehavior extends Behavior { } public boolean throwaway(boolean select, Predicate desired) { + return throwaway(select, desired, BaritoneAPI.getSettings().allowInventory.value); + } + + public boolean throwaway(boolean select, Predicate desired, boolean allowInventory) { EntityPlayerSP p = ctx.player(); NonNullList inv = p.inventory.mainInventory; for (int i = 0; i < 9; i++) { @@ -184,6 +189,19 @@ public final class InventoryBehavior extends Behavior { } } } + + if (allowInventory) { + for (int i = 9; i < 36; i++) { + if (desired.test(inv.get(i))) { + swapWithHotBar(i, 7); + if (select) { + p.inventory.currentItem = 7; + } + return true; + } + } + } + return false; } } From 64ba96daf2029f7cc70188faf15ecc96517f3903 Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Mon, 14 Jun 2021 20:44:32 +0100 Subject: [PATCH 2/2] Do edit suggested by leijurv --- src/main/java/baritone/behavior/InventoryBehavior.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/InventoryBehavior.java b/src/main/java/baritone/behavior/InventoryBehavior.java index 3741b088..4fcde5a7 100644 --- a/src/main/java/baritone/behavior/InventoryBehavior.java +++ b/src/main/java/baritone/behavior/InventoryBehavior.java @@ -153,7 +153,7 @@ public final class InventoryBehavior extends Behavior { } public boolean throwaway(boolean select, Predicate desired) { - return throwaway(select, desired, BaritoneAPI.getSettings().allowInventory.value); + return throwaway(select, desired, Baritone.settings().allowInventory.value); } public boolean throwaway(boolean select, Predicate desired, boolean allowInventory) {