Skip to content

PlayerMovementInput does incorrect impulse calculation in 1.21.4+ #5071

Description

@mankool0

In PlayerMovementInput.tick() for sneaking we do:

boolean sneaking = handler.isInputForcedDown(Input.SNEAK);
if (sneaking) {
    this.leftImpulse    *= 0.3D;
    this.forwardImpulse *= 0.3D;
}

But in Minecraft 1.21.4+ the sneaking impulse scaling was moved from ClientInput.tick() to LocalPlayer.aiStep():

if (this.isMovingSlowly()) {
    float f = (float)this.getAttributeValue(Attributes.SNEAKING_SPEED); // default 0.3
    this.input.leftImpulse    *= f;
    this.input.forwardImpulse *= f;
}

So when Baritone sneaks we end up with * 0.3 being applied twice and in servers that use Grim AC you end up constantly failing the simulation check when crouching.

The fix is to just remove the scaling from PlayerMovementInput.tick().
I can do this but just want to know which branches I should cover. I can do all 1.21.4+ branches if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions