Skip to content

Commit

Permalink
Add "Pause for mace" checkbox to NoFallHack
Browse files Browse the repository at this point in the history
Fixes #1012
  • Loading branch information
Alexander01998 committed Jun 25, 2024
1 parent 1698c35 commit 8b7c7cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/java/net/wurstclient/hacks/NoFallHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -41,6 +47,9 @@ public String getRenderName()
if(player.isCreative())
return getName() + " (paused)";

if(pauseForMace.isChecked() && isHoldingMace(player))
return getName() + " (paused)";

return getName();
}

Expand Down Expand Up @@ -68,6 +77,10 @@ public void onUpdate()
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
Expand All @@ -85,6 +98,11 @@ public void onUpdate()
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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/wurst/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 8b7c7cf

Please sign in to comment.