be more tolerant of alternate movement inputs

This commit is contained in:
Leijurv 2019-02-07 10:46:32 -08:00
parent 46f8829951
commit c0761c0eef
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -25,7 +25,6 @@ import baritone.api.utils.input.Input;
import baritone.behavior.Behavior;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.MovementInput;
import net.minecraft.util.MovementInputFromOptions;
import java.util.HashMap;
@ -111,14 +110,17 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
}
blockBreakHelper.tick(isInputForcedDown(Input.CLICK_LEFT));
MovementInput desired = inControl()
? new PlayerMovementInput(this)
: new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
if (ctx.player().movementInput.getClass() != desired.getClass()) {
ctx.player().movementInput = desired; // only set it if it was previously incorrect
// gotta do it this way, or else it constantly thinks you're beginning a double tap W sprint lol
if (inControl()) {
if (ctx.player().movementInput.getClass() != PlayerMovementInput.class) {
ctx.player().movementInput = new PlayerMovementInput(this);
}
} else {
if (ctx.player().movementInput.getClass() == PlayerMovementInput.class) {
ctx.player().movementInput = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
}
}
// only set it if it was previously incorrect
// gotta do it this way, or else it constantly thinks you're beginning a double tap W sprint lol
}
private boolean inControl() {