wait a tick until objectMouseOver matches, fixes #254

This commit is contained in:
Leijurv 2018-11-09 15:59:03 -08:00
parent f2dcdda9b3
commit 13505a052f
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -20,10 +20,7 @@ package baritone.pathing.movement;
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.BlockStateInterface;
import baritone.utils.Helper;
import baritone.utils.InputOverrideHandler;
@ -34,6 +31,7 @@ import net.minecraft.world.chunk.EmptyChunk;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import static baritone.utils.InputOverrideHandler.Input;
@ -154,7 +152,10 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
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
@ -163,7 +164,9 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
//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;
}
}