mirror of https://github.com/cabaletta/baritone
simplify smoothLook into one setting and separate smoothLook from freeLook
This commit is contained in:
parent
46f38f2ce7
commit
c0a1e6540f
|
@ -745,16 +745,10 @@ public final class Settings {
|
||||||
* Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
|
* Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
|
||||||
* Requires {@link #freeLook}.
|
* Requires {@link #freeLook}.
|
||||||
*/
|
*/
|
||||||
public final Setting<Boolean> smoothLookYaw = new Setting<>(false);
|
public final Setting<Boolean> smoothLook = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces the client-sided pitch rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
|
* The number of ticks to average across for {@link #smoothLook};
|
||||||
* Requires {@link #freeLook}.
|
|
||||||
*/
|
|
||||||
public final Setting<Boolean> smoothLookPitch = new Setting<>(false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of ticks to average across for {@link #smoothLookYaw} and {@link #smoothLookPitch};
|
|
||||||
*/
|
*/
|
||||||
public final Setting<Integer> smoothLookTicks = new Setting<>(10);
|
public final Setting<Integer> smoothLookTicks = new Setting<>(10);
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,15 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
||||||
this.smoothPitchBuffer.pop();
|
this.smoothPitchBuffer.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.player().rotationYaw = Baritone.settings().smoothLookYaw.value
|
if (Baritone.settings().freeLook.value) {
|
||||||
? (float) this.smoothYawBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getYaw)
|
ctx.player().rotationYaw = this.prevRotation.getYaw();
|
||||||
: this.prevRotation.getYaw();
|
ctx.player().rotationPitch = this.prevRotation.getPitch();
|
||||||
ctx.player().rotationPitch = Baritone.settings().smoothLookPitch.value
|
} else if (Baritone.settings().smoothLook.value) {
|
||||||
? (float) this.smoothPitchBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getPitch)
|
ctx.player().rotationYaw = (float) this.smoothYawBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getYaw);
|
||||||
: this.prevRotation.getPitch();
|
ctx.player().rotationPitch = ctx.player().isElytraFlying()
|
||||||
|
? (float) this.smoothPitchBuffer.stream().mapToDouble(d -> d).average().orElseGet(this.prevRotation::getPitch)
|
||||||
|
: this.prevRotation.getPitch();
|
||||||
|
}
|
||||||
|
|
||||||
this.prevRotation = null;
|
this.prevRotation = null;
|
||||||
}
|
}
|
||||||
|
@ -327,12 +330,10 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
||||||
final boolean blockFreeLook = settings.blockFreeLook.value;
|
final boolean blockFreeLook = settings.blockFreeLook.value;
|
||||||
final boolean freeLook = settings.freeLook.value;
|
final boolean freeLook = settings.freeLook.value;
|
||||||
|
|
||||||
if (!freeLook) return CLIENT;
|
if (!freeLook && !settings.smoothLook.value) return CLIENT;
|
||||||
if (!blockFreeLook && blockInteract) return CLIENT;
|
if (!blockFreeLook && blockInteract) return CLIENT;
|
||||||
|
|
||||||
if (ctx.player().isElytraFlying()) {
|
|
||||||
return settings.elytraFreeLook.value ? SERVER : CLIENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Regardless of if antiCheatCompatibility is enabled, if a blockInteract is requested then the player
|
// 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
|
// rotation needs to be set somehow, otherwise Baritone will halt since objectMouseOver() will just be
|
||||||
|
|
Loading…
Reference in New Issue