Allow freeLook when using elytra

This commit is contained in:
Brady
2023-06-14 16:11:11 -05:00
parent 9672bd2c6d
commit bde0c620ad
6 changed files with 121 additions and 40 deletions

View File

@@ -264,17 +264,19 @@ public class Elytra extends Behavior implements Helper {
}
if (requireClear ? isClear(start, dest) : clearView(start, dest)) {
Rotation rot = RotationUtils.calcRotationFromVec3d(start, dest, ctx.playerRotations());
ctx.player().rotationYaw = rot.getYaw();
// ctx.player().rotationYaw = rot.getYaw();
long a = System.currentTimeMillis();
Float pitch = solvePitch(dest.subtract(start), steps, relaxation == 2);
if (pitch == null) {
baritone.getLookBehavior().updateTarget(new Rotation(rot.getYaw(), ctx.playerRotations().getPitch()), false);
continue;
}
long b = System.currentTimeMillis();
ctx.player().rotationPitch = pitch;
// ctx.player().rotationPitch = pitch;
System.out.println("Solved pitch in " + (b - a) + " total time " + (b - t));
goingTo = i;
goal = path.get(i).add(0, dy, 0);
baritone.getLookBehavior().updateTarget(new Rotation(rot.getYaw(), pitch), false);
return;
}
}

View File

@@ -149,6 +149,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
public void onPlayerRotationMove(RotationMoveEvent event) {
if (this.target != null) {
event.setYaw(this.target.rotation.getYaw());
event.setPitch(this.target.rotation.getPitch());
}
}