Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Options for Sprinting #772

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/main/java/net/wurstclient/hacks/AutoSprintHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
import net.wurstclient.SearchTags;
import net.wurstclient.events.UpdateListener;
import net.wurstclient.hack.Hack;
import net.wurstclient.settings.CheckboxSetting;

@SearchTags({"auto sprint"})
public final class AutoSprintHack extends Hack implements UpdateListener
{
private final CheckboxSetting hungry = new CheckboxSetting("Hungry Sprint",
"Sprint even on low hunger.", false);

public AutoSprintHack()
{
super("AutoSprint");
setCategory(Category.MOVEMENT);
addSetting(hungry);
}

@Override
Expand Down Expand Up @@ -48,4 +53,9 @@ public void onUpdate()
if(player.forwardSpeed > 0)
player.setSprinting(true);
}

public boolean shouldSprintHungry()
{
return isEnabled() && hungry.isChecked();
}
}
11 changes: 11 additions & 0 deletions src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ private void afterUpdateNausea(CallbackInfo ci)
tempCurrentScreen = null;
}

/**
* This mixin allows AutoSprint to enable sprinting even when the player is
* too hungry.
*/
@Inject(at = @At("HEAD"), method = "canSprint()Z", cancellable = true)
private void onCanSprint(CallbackInfoReturnable<Boolean> cir)
{
if(WurstClient.INSTANCE.getHax().autoSprintHack.shouldSprintHungry())
cir.setReturnValue(true);
}

/**
* Getter method for what used to be airStrafingSpeed.
* Overridden to allow for the speed to be modified by hacks.
Expand Down