Remove direct reference to allowInventory in BuilderProcess

This commit is contained in:
Brady
2023-07-01 15:38:23 -05:00
parent 4bf2dd6851
commit b2cdd27ca2
2 changed files with 7 additions and 6 deletions

View File

@@ -185,10 +185,6 @@ public final class InventoryBehavior extends Behavior implements Helper {
}
public boolean throwaway(boolean select, Predicate<? super ItemStack> desired) {
return this.throwaway(select, desired, Baritone.settings().allowInventory.value);
}
public boolean throwaway(boolean select, Predicate<? super ItemStack> desired, boolean allowInventory) {
EntityPlayerSP p = ctx.player();
NonNullList<ItemStack> inv = p.inventory.mainInventory;
for (int i = 0; i < 9; i++) {
@@ -205,6 +201,7 @@ public final class InventoryBehavior extends Behavior implements Helper {
return true;
}
}
if (desired.test(p.inventory.offHandInventory.get(0))) {
// main hand takes precedence over off hand
// that means that if we have block A selected in main hand and block B in off hand, right clicking places block B
@@ -222,7 +219,7 @@ public final class InventoryBehavior extends Behavior implements Helper {
}
}
if (allowInventory) {
if (this.canAccessInventory()) {
for (int i = 9; i < 36; i++) {
if (desired.test(inv.get(i))) {
if (select) {
@@ -236,4 +233,8 @@ public final class InventoryBehavior extends Behavior implements Helper {
return false;
}
public boolean canAccessInventory() {
return Baritone.settings().allowInventory.value;
}
}

View File

@@ -542,7 +542,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL);
}
if (Baritone.settings().allowInventory.value) {
if (baritone.getInventoryBehavior().canAccessInventory()) {
ArrayList<Integer> usefulSlots = new ArrayList<>();
List<IBlockState> noValidHotbarOption = new ArrayList<>();
outer: