Make farm use inventory when allowInventory is enabled.
This commit is contained in:
parent
e85c1bbc0d
commit
f09f1e7f85
@ -18,6 +18,7 @@
|
|||||||
package baritone.behavior;
|
package baritone.behavior;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.event.events.TickEvent;
|
import baritone.api.event.events.TickEvent;
|
||||||
import baritone.utils.ToolSet;
|
import baritone.utils.ToolSet;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -152,6 +153,10 @@ public final class InventoryBehavior extends Behavior {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean throwaway(boolean select, Predicate<? super ItemStack> desired) {
|
public boolean throwaway(boolean select, Predicate<? super ItemStack> desired) {
|
||||||
|
return throwaway(select, desired, BaritoneAPI.getSettings().allowInventory.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean throwaway(boolean select, Predicate<? super ItemStack> desired, boolean allowInventory) {
|
||||||
EntityPlayerSP p = ctx.player();
|
EntityPlayerSP p = ctx.player();
|
||||||
NonNullList<ItemStack> inv = p.inventory.mainInventory;
|
NonNullList<ItemStack> inv = p.inventory.mainInventory;
|
||||||
for (int i = 0; i < 9; i++) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user