Clean falling movement generation
This commit is contained in:
parent
e30405c0ca
commit
b7eaf881a0
@ -5,6 +5,7 @@ import baritone.bot.pathing.calc.openset.IOpenSet;
|
||||
import baritone.bot.pathing.goals.Goal;
|
||||
import baritone.bot.pathing.movement.ActionCosts;
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import baritone.bot.pathing.movement.MovementHelper;
|
||||
import baritone.bot.pathing.movement.movements.MovementAscend;
|
||||
import baritone.bot.pathing.movement.movements.MovementDownward;
|
||||
import baritone.bot.pathing.movement.movements.MovementFall;
|
||||
@ -163,10 +164,10 @@ public class AStarPathFinder extends AbstractNodeCostSearch {
|
||||
movements[5] = new MovementAscend(pos, new BlockPos(x - 1, y + 1, z));
|
||||
movements[6] = new MovementAscend(pos, new BlockPos(x, y + 1, z + 1));
|
||||
movements[7] = new MovementAscend(pos, new BlockPos(x, y + 1, z - 1));
|
||||
movements[8] = MovementFall.generateMovementFallOrDescend(pos, EnumFacing.NORTH);
|
||||
movements[9] = MovementFall.generateMovementFallOrDescend(pos, EnumFacing.SOUTH);
|
||||
movements[10] = MovementFall.generateMovementFallOrDescend(pos, EnumFacing.EAST);
|
||||
movements[11] = MovementFall.generateMovementFallOrDescend(pos, EnumFacing.WEST);
|
||||
movements[8] = MovementHelper.generateMovementFallOrDescend(pos, EnumFacing.NORTH);
|
||||
movements[9] = MovementHelper.generateMovementFallOrDescend(pos, EnumFacing.SOUTH);
|
||||
movements[10] = MovementHelper.generateMovementFallOrDescend(pos, EnumFacing.EAST);
|
||||
movements[11] = MovementHelper.generateMovementFallOrDescend(pos, EnumFacing.WEST);
|
||||
movements[12] = new MovementDownward(pos);
|
||||
/*Action[] actions = new Action[26];
|
||||
actions[0] = new ActionPillar(pos);
|
||||
|
@ -200,11 +200,10 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
if (onto.getY() <= 0) {
|
||||
break;
|
||||
}
|
||||
IBlockState fallOn = BlockStateInterface.get(onto);
|
||||
if (fallOn.getBlock() instanceof BlockAir) {
|
||||
if (BlockStateInterface.isAir(onto)) {
|
||||
continue;
|
||||
}
|
||||
if (BlockStateInterface.isWater(fallOn.getBlock())) {
|
||||
if (BlockStateInterface.isWater(onto)) {
|
||||
return new MovementFall(pos, onto);
|
||||
}
|
||||
if (MovementHelper.canWalkOn(onto)) {
|
||||
|
@ -12,12 +12,9 @@ import baritone.bot.utils.BlockStateInterface;
|
||||
import baritone.bot.utils.Rotation;
|
||||
import baritone.bot.utils.ToolSet;
|
||||
import baritone.bot.utils.Utils;
|
||||
import net.minecraft.block.BlockAir;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
@ -73,9 +70,10 @@ public class MovementFall extends Movement {
|
||||
if(!player().inventory.hasItemStack(new ItemStack(new ItemBucket(Blocks.WATER)))) {
|
||||
state.setStatus(MovementStatus.UNREACHABLE);
|
||||
}
|
||||
player().inventory.currentItem = player().inventory.getSlotFor(new ItemStack(new ItemBucket(Blocks.WATER)));
|
||||
LookBehaviorUtils.reachable(dest).ifPresent(rotation ->
|
||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true)
|
||||
.setTarget(new MovementTarget(rotation))
|
||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true)
|
||||
.setTarget(new MovementTarget(rotation))
|
||||
);
|
||||
} else {
|
||||
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(dest, world()));
|
||||
|
Loading…
Reference in New Issue
Block a user