Skip to content

Commit

Permalink
wait a tick until objectMouseOver matches, fixes #254
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Nov 10, 2018
1 parent ffc0506 commit 654ac10
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/baritone/pathing/movement/Movement.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
import baritone.Baritone;
import baritone.api.pathing.movement.IMovement;
import baritone.api.pathing.movement.MovementStatus;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Rotation;
import baritone.api.utils.RotationUtils;
import baritone.api.utils.VecUtils;
import baritone.api.utils.*;
import baritone.utils.BlockBreakHelper;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper;
Expand All @@ -36,6 +33,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import static baritone.utils.InputOverrideHandler.Input;
Expand Down Expand Up @@ -177,7 +175,10 @@ protected boolean prepared(MovementState state) {
Optional<Rotation> reachable = RotationUtils.reachable(player(), blockPos);
if (reachable.isPresent()) {
MovementHelper.switchToBestToolFor(BlockStateInterface.get(blockPos));
state.setTarget(new MovementState.MovementTarget(reachable.get(), true)).setInput(Input.CLICK_LEFT, true);
state.setTarget(new MovementState.MovementTarget(reachable.get(), true));
if (Objects.equals(RayTraceUtils.getSelectedBlock().orElse(null), blockPos)) {
state.setInput(Input.CLICK_LEFT, true);
}
return false;
}
//get rekt minecraft
Expand All @@ -186,7 +187,9 @@ protected boolean prepared(MovementState state) {
//you dont own me!!!!
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(player().getPositionEyes(1.0F),
VecUtils.getBlockPosCenter(blockPos)), true)
).setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
);
// don't check selectedblock on this one, this is a fallback when we can't see any face directly, it's intended to be breaking the "incorrect" block
state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
return false;
}
}
Expand Down

0 comments on commit 654ac10

Please sign in to comment.