Skip to content

Commit

Permalink
Fix disableNextTick preventing player from walking (regression) (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
hashalite authored Jan 20, 2024
2 parents 1878392 + f8f9cbd commit 6050e13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions common/src/main/java/net/xolt/freecam/Freecam.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ public class Freecam {
private static CameraType rememberedF5 = null;

public static void preTick(Minecraft mc) {
if (isEnabled()) {
// Disable if the previous tick asked us to
if (disableNextTick) {
toggle();
}
// Disable if the previous tick asked us to
if (disableNextTick && isEnabled()) {
toggle();
}
disableNextTick = false;

if (isEnabled()) {
// Prevent player from being controlled when freecam is enabled
if (mc.player != null && mc.player.input instanceof KeyboardInput && !isPlayerControlEnabled()) {
Input input = new Input();
Expand All @@ -52,7 +53,6 @@ public static void preTick(Minecraft mc) {

mc.gameRenderer.setRenderHand(ModConfig.INSTANCE.visual.showHand);
}
disableNextTick = false;
}

public static void postTick(Minecraft mc) {
Expand Down

0 comments on commit 6050e13

Please sign in to comment.