if already looking at the block, no need to change rotation

This commit is contained in:
Leijurv 2018-08-06 13:50:38 -07:00
parent 3eef5e2972
commit 233f1d9e3e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -1,5 +1,6 @@
package baritone.bot.behavior.impl; package baritone.bot.behavior.impl;
import baritone.bot.pathing.movement.MovementHelper;
import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Helper; import baritone.bot.utils.Helper;
import baritone.bot.utils.Rotation; import baritone.bot.utils.Rotation;
@ -11,7 +12,7 @@ import java.util.Optional;
public final class LookBehaviorUtils implements Helper { public final class LookBehaviorUtils implements Helper {
public static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[] { public static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[]{
new Vec3d(0, 0.5, 0.5), new Vec3d(0, 0.5, 0.5),
new Vec3d(1, 0.5, 0.5), new Vec3d(1, 0.5, 0.5),
new Vec3d(0.5, 0, 0.5), new Vec3d(0.5, 0, 0.5),
@ -35,6 +36,9 @@ public final class LookBehaviorUtils implements Helper {
} }
public static Optional<Rotation> reachable(BlockPos pos) { public static Optional<Rotation> reachable(BlockPos pos) {
if (pos.equals(MovementHelper.whatAmILookingAt().orElse(null))) {
return Optional.of(new Rotation(mc.player.rotationYaw, mc.player.rotationPitch));
}
Optional<Rotation> possibleRotation = reachableCenter(pos); Optional<Rotation> possibleRotation = reachableCenter(pos);
if (possibleRotation.isPresent()) if (possibleRotation.isPresent())
return possibleRotation; return possibleRotation;
@ -67,6 +71,7 @@ public final class LookBehaviorUtils implements Helper {
/** /**
* Checks if coordinate is reachable with the given block-face rotation offset * Checks if coordinate is reachable with the given block-face rotation offset
*
* @param pos * @param pos
* @param offset * @param offset
* @return * @return
@ -84,6 +89,7 @@ public final class LookBehaviorUtils implements Helper {
/** /**
* Checks if center of block at coordinate is reachable * Checks if center of block at coordinate is reachable
*
* @param pos * @param pos
* @return * @return
*/ */