separate smooth look setting for elytra

This commit is contained in:
Babbaj 2023-07-31 16:41:10 -04:00
parent c0a1e6540f
commit 0ca173f5dc
No known key found for this signature in database
GPG Key ID: F044309848A07CAC
2 changed files with 8 additions and 8 deletions

View File

@ -737,16 +737,20 @@ public final class Settings {
public final Setting<Boolean> blockFreeLook = new Setting<>(false);
/**
* Automatically elytra fly without having to force the client-sided rotations. Requires {@link #freeLook}.
* Automatically elytra fly without having to force the client-sided rotations.
*/
public final Setting<Boolean> elytraFreeLook = new Setting<>(false);
/**
* Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
* Requires {@link #freeLook}.
*/
public final Setting<Boolean> smoothLook = new Setting<>(false);
/**
* Same as {@link #smoothLook} but for elytra flying.
*/
public final Setting<Boolean> elytraSmoothLook = new Setting<>(true);
/**
* The number of ticks to average across for {@link #smoothLook};
*/

View File

@ -112,10 +112,10 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
this.smoothPitchBuffer.pop();
}
if (Baritone.settings().freeLook.value) {
if ((ctx.player().isElytraFlying() && Baritone.settings().elytraFreeLook.value) || (!ctx.player().isElytraFlying() && Baritone.settings().freeLook.value)) {
ctx.player().rotationYaw = this.prevRotation.getYaw();
ctx.player().rotationPitch = this.prevRotation.getPitch();
} else if (Baritone.settings().smoothLook.value) {
} else if ((ctx.player().isElytraFlying() && Baritone.settings().elytraSmoothLook.value) || (!ctx.player().isElytraFlying() && Baritone.settings().smoothLook.value)) {
ctx.player().rotationYaw = (float) this.smoothYawBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getYaw);
ctx.player().rotationPitch = ctx.player().isElytraFlying()
? (float) this.smoothPitchBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getPitch)
@ -328,13 +328,9 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
final Settings settings = Baritone.settings();
final boolean antiCheat = settings.antiCheatCompatibility.value;
final boolean blockFreeLook = settings.blockFreeLook.value;
final boolean freeLook = settings.freeLook.value;
if (!freeLook && !settings.smoothLook.value) return CLIENT;
if (!blockFreeLook && blockInteract) return CLIENT;
// Regardless of if antiCheatCompatibility is enabled, if a blockInteract is requested then the player
// rotation needs to be set somehow, otherwise Baritone will halt since objectMouseOver() will just be
// whatever the player is mousing over visually. Let's just settle for setting it silently.