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:
commit
ae75d64a56
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user