Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ControllerPlayerMovement extends /*? if >=1.21.2 {*/ ClientInput /*
private final ControllerEntity controller;
private final LocalPlayer player;
private boolean wasFlying, wasPassenger;
private boolean wasInScreen;

public ControllerPlayerMovement(ControllerEntity controller, LocalPlayer player) {
this.controller = controller;
Expand All @@ -32,7 +33,9 @@ public void tick() {
//?} else {
/*public void tick(boolean slowDown, float movementMultiplier) {
*///?}
if (Minecraft.getInstance().screen != null || player == null) {
boolean inScreen = Minecraft.getInstance().screen != null;

if (inScreen || player == null) {
this.setMoveVec(0, 0);

//? if >=1.21.2 {
Expand All @@ -46,6 +49,7 @@ public void tick() {
this.shiftKeyDown = false;
*///?}

this.wasInScreen = true;
return;
}

Expand Down Expand Up @@ -95,14 +99,17 @@ public void tick() {
if (!sneak.digitalNow())
shiftKeyDown = false;
} else {
if (sneak.justPressed()) {
// Only toggle if we're not just coming out of a screen
if (sneak.justPressed() && !this.wasInScreen) {
shiftKeyDown = !shiftKeyDown;
}
}
if ((!player.getAbilities().flying && wasFlying && player.onGround()) || (!player.isPassenger() && wasPassenger)) {
shiftKeyDown = false;
}

this.wasInScreen = false;

//? if >=1.21.2 {
boolean sprinting = ControlifyBindings.SPRINT.on(controller).digitalNow();

Expand Down