Add hotbar check for presence of water bucket
This commit is contained in:
parent
3dc544b120
commit
ff929b9260
@ -19,6 +19,7 @@ package baritone.bot.pathing.movement;
|
||||
|
||||
import baritone.bot.utils.Helper;
|
||||
import baritone.bot.utils.ToolSet;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ -28,6 +29,8 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public class CalculationContext implements Helper {
|
||||
|
||||
private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
|
||||
|
||||
private final ToolSet toolSet;
|
||||
private final boolean hasWaterBucket;
|
||||
|
||||
@ -37,7 +40,7 @@ public class CalculationContext implements Helper {
|
||||
|
||||
public CalculationContext(ToolSet toolSet) {
|
||||
this.toolSet = toolSet;
|
||||
this.hasWaterBucket = player().inventory.hasItemStack(new ItemStack(Items.WATER_BUCKET)); // TODO check if water bucket is on hotbar or main inventory
|
||||
this.hasWaterBucket = InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER));
|
||||
}
|
||||
|
||||
public ToolSet getToolSet() {
|
||||
|
@ -35,7 +35,7 @@ import java.util.Optional;
|
||||
public class MovementFall extends Movement {
|
||||
|
||||
private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
|
||||
private static final ItemStack STACK_BUCKET_AIR = new ItemStack(Items.BUCKET);
|
||||
private static final ItemStack STACK_BUCKET_EMPTY = new ItemStack(Items.BUCKET);
|
||||
|
||||
public MovementFall(BlockPos src, BlockPos dest) {
|
||||
super(src, dest, MovementFall.buildPositionsToBreak(src, dest), new BlockPos[]{dest.down()});
|
||||
@ -89,8 +89,8 @@ public class MovementFall extends Movement {
|
||||
}
|
||||
if (playerFeet.equals(dest) && (player().posY - playerFeet.getY() < 0.01
|
||||
|| BlockStateInterface.isWater(dest))) {
|
||||
if (BlockStateInterface.isWater(dest) && player().inventory.hasItemStack(STACK_BUCKET_AIR)) {
|
||||
player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_AIR);
|
||||
if (BlockStateInterface.isWater(dest) && player().inventory.hasItemStack(STACK_BUCKET_EMPTY)) {
|
||||
player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_EMPTY);
|
||||
if (player().motionY >= 0) {
|
||||
return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user