even more mega smooth

This commit is contained in:
Leijurv 2018-08-06 16:58:06 -07:00
parent d8a99f8459
commit c6bee3addb
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
5 changed files with 16 additions and 24 deletions

View File

@ -1,13 +1,11 @@
package baritone.bot.pathing.movement; package baritone.bot.pathing.movement;
import baritone.bot.Baritone; import baritone.bot.Baritone;
import baritone.bot.InputOverrideHandler;
import baritone.bot.behavior.impl.LookBehavior; import baritone.bot.behavior.impl.LookBehavior;
import baritone.bot.behavior.impl.LookBehaviorUtils; import baritone.bot.behavior.impl.LookBehaviorUtils;
import baritone.bot.pathing.movement.MovementState.MovementStatus; import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.*;
import baritone.bot.utils.Helper;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -178,4 +176,8 @@ public abstract class Movement implements Helper, MovementHelper {
toPlaceCached = result; toPlaceCached = result;
return result; return result;
} }
protected void moveTowards(BlockPos pos) {
currentState.setTarget(new MovementState.MovementTarget(new Rotation(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(pos, world())).getFirst(), player().rotationPitch))).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
}
} }

View File

@ -6,9 +6,7 @@ import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState; import baritone.bot.pathing.movement.MovementState;
import baritone.bot.pathing.movement.MovementState.MovementStatus; import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -80,9 +78,8 @@ public class MovementAscend extends Movement {
state.setStatus(MovementStatus.SUCCESS); state.setStatus(MovementStatus.SUCCESS);
return state; return state;
} }
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())); moveTowards(positionsToBreak[0]);
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)) return state.setInput(InputOverrideHandler.Input.JUMP, true);
.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
default: default:
return state; return state;
} }

View File

@ -1,14 +1,11 @@
package baritone.bot.pathing.movement.movements; package baritone.bot.pathing.movement.movements;
import baritone.bot.InputOverrideHandler;
import baritone.bot.pathing.movement.Movement; import baritone.bot.pathing.movement.Movement;
import baritone.bot.pathing.movement.MovementHelper; import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState; import baritone.bot.pathing.movement.MovementState;
import baritone.bot.pathing.movement.MovementState.MovementStatus; import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder; import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine; import net.minecraft.block.BlockVine;
@ -50,8 +47,8 @@ public class MovementDescend extends Movement {
state.setStatus(MovementStatus.SUCCESS); state.setStatus(MovementStatus.SUCCESS);
return state; return state;
} }
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[1], world())); moveTowards(positionsToBreak[1]);
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); return state;
default: default:
return state; return state;
} }

View File

@ -1,13 +1,10 @@
package baritone.bot.pathing.movement.movements; package baritone.bot.pathing.movement.movements;
import baritone.bot.InputOverrideHandler;
import baritone.bot.pathing.movement.Movement; import baritone.bot.pathing.movement.Movement;
import baritone.bot.pathing.movement.MovementHelper; import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState; import baritone.bot.pathing.movement.MovementState;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder; import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockVine; import net.minecraft.block.BlockVine;
@ -38,8 +35,8 @@ public class MovementDownward extends Movement {
if (numTicks++ < 10) { if (numTicks++ < 10) {
return state; return state;
} }
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())); moveTowards(positionsToBreak[0]);
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); return state;
default: default:
return state; return state;
} }

View File

@ -6,7 +6,6 @@ import baritone.bot.pathing.movement.Movement;
import baritone.bot.pathing.movement.MovementHelper; import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.pathing.movement.MovementState; import baritone.bot.pathing.movement.MovementState;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Rotation;
import baritone.bot.utils.ToolSet; import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils; import baritone.bot.utils.Utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -118,8 +117,8 @@ public class MovementTraverse extends Movement {
if (wasTheBridgeBlockAlwaysThere) { if (wasTheBridgeBlockAlwaysThere) {
player().setSprinting(true); player().setSprinting(true);
} }
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())); moveTowards(positionsToBreak[0]);
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); return state;
} else { } else {
wasTheBridgeBlockAlwaysThere = false; wasTheBridgeBlockAlwaysThere = false;
for (BlockPos against1 : against) { for (BlockPos against1 : against) {
@ -170,8 +169,8 @@ public class MovementTraverse extends Movement {
//Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt()); //Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt());
return state; return state;
} else { } else {
Rotation rotationToBlock = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())); moveTowards(positionsToBreak[0]);
return state.setTarget(new MovementState.MovementTarget(rotationToBlock)).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); return state;
//TODO MovementManager.moveTowardsBlock(to);//move towards not look at because if we are bridging for a couple blocks in a row, it is faster if we dont spin around and walk forwards then spin around and place backwards for every block //TODO MovementManager.moveTowardsBlock(to);//move towards not look at because if we are bridging for a couple blocks in a row, it is faster if we dont spin around and walk forwards then spin around and place backwards for every block
} }
} }