0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Merge #772 (AutoSprint hunger setting)

This commit is contained in:
Alexander01998 2023-12-15 15:38:59 +01:00 committed by GitHub
commit ae75d64a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -12,14 +12,19 @@ import net.wurstclient.Category;
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
@ -48,4 +53,9 @@ public final class AutoSprintHack extends Hack implements UpdateListener
if(player.forwardSpeed > 0)
player.setSprinting(true);
}
public boolean shouldSprintHungry()
{
return isEnabled() && hungry.isChecked();
}
}

View File

@ -169,6 +169,17 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
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.