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