Skip to content

Commit

Permalink
Fix also persisting the Auto-Jump toggled by Auto-Run
Browse files Browse the repository at this point in the history
  • Loading branch information
emonadeo committed Mar 19, 2024
1 parent 071aed3 commit 1bd9356
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/client/java/com/emonadeo/autorun/AutoRunMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
public class AutoRunMod implements ClientModInitializer {

public static final String MODID = "autorun";
public static final File CFG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "autorun.properties");
public static final File CFG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(),
"autorun.properties");

private static KeyBinding keyBinding;
private static Set<MovementDirection> toggled;
Expand Down Expand Up @@ -79,8 +80,7 @@ public void onInitializeClient() {

if (timeActivated != -1 && client.world != null
&& client.world.getTime() - timeActivated >= delayBuffer) {
x:
for (MovementDirection dir : toggled) {
x: for (MovementDirection dir : toggled) {
for (KeyBinding terminator : dir.getTerminators(client)) {
if (terminator.isPressed()) {
// Deactivating by pressing movement key
Expand All @@ -96,12 +96,11 @@ public void onInitializeClient() {

ClientEntityEvents.ENTITY_UNLOAD.register((entity, clientWorld) -> {
if (entity instanceof ClientPlayerEntity) {
restoreAutoJump(MinecraftClient.getInstance());
if (!togglePersistAutoRun){
if (!togglePersistAutoRun) {
toggled.clear();
restoreAutoJump(MinecraftClient.getInstance());
}
};

}
});
}

Expand Down Expand Up @@ -172,7 +171,7 @@ public static boolean isToggleAutoJump() {
public static void setToggleAutoJump(boolean toggleAutoJump) {
AutoRunMod.toggleAutoJump = toggleAutoJump;
}

public static boolean isPersistAutoRun() {
return togglePersistAutoRun;
}
Expand Down

0 comments on commit 1bd9356

Please sign in to comment.