cabaletta / cabaletta/baritone

PlayerMovementInput does incorrect impulse calculation in 1.21.4+

Open Beginner friendly
#5,071 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
9.2k
Forks
2.1k
Avg merge
4d 3h
Merged PRs (30d)
3

Description

In `PlayerMovementInput.tick()` for sneaking we do:
```java
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()`:
```java
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in PlayerMovementInput.tick() and compare the sneaking handling with the Minecraft 1.21.4+ behavior described in LocalPlayer.aiStep(). Check the relevant 1.21.4+ branches before making the small change. Done means sneaking impulse is scaled only once and the affected branch behavior no longer applies the duplicate 0.3 multiplier.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.