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

Add "Pause for mace" checkbox to NoFallHack

Fixes #1012
This commit is contained in:
Alexander01998 2024-06-25 16:22:07 +02:00
parent 1698c352bf
commit 8b7c7cf517
2 changed files with 20 additions and 1 deletions

View File

@ -8,6 +8,7 @@
package net.wurstclient.hacks;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.OnGroundOnly;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
@ -21,11 +22,16 @@ public final class NoFallHack extends Hack implements UpdateListener
private final CheckboxSetting allowElytra = new CheckboxSetting(
"Allow elytra", "description.wurst.setting.nofall.allow_elytra", false);
private final CheckboxSetting pauseForMace =
new CheckboxSetting("Pause for mace",
"description.wurst.setting.nofall.pause_for_mace", false);
public NoFallHack()
{
super("NoFall");
setCategory(Category.MOVEMENT);
addSetting(allowElytra);
addSetting(pauseForMace);
}
@Override
@ -41,6 +47,9 @@ public final class NoFallHack extends Hack implements UpdateListener
if(player.isCreative())
return getName() + " (paused)";
if(pauseForMace.isChecked() && isHoldingMace(player))
return getName() + " (paused)";
return getName();
}
@ -68,6 +77,10 @@ public final class NoFallHack extends Hack implements UpdateListener
boolean fallFlying = player.isFallFlying();
if(fallFlying && !allowElytra.isChecked())
return;
// pause when holding a mace, if enabled
if(pauseForMace.isChecked() && isHoldingMace(player))
return;
// ignore small falls that can't cause damage,
// unless CreativeFlight is enabled in survival mode
@ -85,6 +98,11 @@ public final class NoFallHack extends Hack implements UpdateListener
player.networkHandler.sendPacket(new OnGroundOnly(true));
}
private boolean isHoldingMace(ClientPlayerEntity player)
{
return player.getMainHandStack().isOf(Items.MACE);
}
private boolean isFallingFastEnoughToCauseDamage(ClientPlayerEntity player)
{
return player.getVelocity().y < -0.5;

View File

@ -146,7 +146,8 @@
"description.wurst.hack.noclip": "Allows you to freely move through blocks.\nA block (e.g. sand) must fall on your head to activate it.\n\n§c§lWARNING:§r You will take damage while moving through blocks!",
"description.wurst.hack.nocomcrash": "Lags and crashes servers using the Nocom exploit.\nDoes not work on Paper servers. Tested working on Vanilla, Spigot, and Fabric. Can be disabled by some AntiCheats.",
"description.wurst.hack.nofall": "Protects you from fall damage.",
"description.wurst.setting.nofall.allow_elytra": "Also tries to prevent fall damage while you are flying with an elytra.\n\n§c§lWARNING:§r This can sometimes cause you to stop flying unexpectedly.",
"description.wurst.setting.nofall.allow_elytra": "Also tries to prevent fall damage while you are flying with an elytra.\n\n§c§lWARNING:§r This can sometimes cause you to stop flying unexpectedly.",
"description.wurst.setting.nofall.pause_for_mace": "Pauses NoFall when holding a mace, so that you can take advantage of the mace's fall distance bonus.\n\n§c§lWARNING:§r You will not be protected from fall damage while you are holding a mace. Also, switching to or away from a mace while you are already falling will interrupt your fall, potentially causing you to take damage.",
"description.wurst.hack.nofireoverlay": "Blocks the overlay when you are on fire.\n\n§c§lWARNING:§r This can cause you to burn to death without noticing.",
"description.wurst.hack.nofog": "Removes distance fog from the world.",
"description.wurst.hack.nohurtcam": "Disables the shaking effect when you get hurt.",