Skip to content

Commit c47f2b7

Browse files
committed
Added cave mode for MaceDMGHack to find free space within fall height if target position is obstructed.
1 parent fc9acd5 commit c47f2b7

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

src/main/java/net/wurstclient/hacks/MaceDmgHack.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.Pos;
1111
import net.minecraft.world.entity.Entity;
1212
import net.minecraft.world.item.Items;
13+
import net.minecraft.world.phys.AABB;
1314
import net.wurstclient.Category;
1415
import net.wurstclient.SearchTags;
1516
import net.wurstclient.events.PlayerAttacksEntityListener;
1617
import net.wurstclient.hack.Hack;
18+
import net.wurstclient.settings.CheckboxSetting;
1719
import net.wurstclient.settings.SliderSetting;
1820
import net.wurstclient.settings.SliderSetting.ValueDisplay;
1921

@@ -22,18 +24,26 @@ public final class MaceDmgHack extends Hack
2224
implements PlayerAttacksEntityListener
2325
{
2426
private static final double DEFAULT_HEIGHT = Math.sqrt(500);
25-
27+
private static final double MIN_FALL = 1.6;
28+
private static final double SCAN_STEP = 0.25;
29+
2630
private final SliderSetting height = new SliderSetting("Height",
2731
"How high to fake before slamming. Height determines the damage boost.",
2832
DEFAULT_HEIGHT, 1.6, 50, 0.1, ValueDisplay.DECIMAL);
29-
33+
34+
private final CheckboxSetting caveMode = new CheckboxSetting("Cave mode",
35+
"Scans for an air gap above you to fall through, so smashes work under"
36+
+ " a ceiling. Fully sealed spaces still can't be smashed.",
37+
true);
38+
3039
private long lastSmashTick = -1;
31-
40+
3241
public MaceDmgHack()
3342
{
3443
super("MaceDMG");
3544
setCategory(Category.COMBAT);
3645
addSetting(height);
46+
addSetting(caveMode);
3747
}
3848

3949
@Override
@@ -70,10 +80,26 @@ public void doSmash()
7080
// Also, let me know if you find a way to bypass that check.
7181
for(int i = 0; i < 4; i++)
7282
sendFakeY(0);
73-
sendFakeY(height.getValue());
83+
sendFakeY(findFallOffset());
7484
sendFakeY(0);
7585
}
76-
86+
87+
private double findFallOffset()
88+
{
89+
double cap = height.getValue();
90+
if(!caveMode.isChecked() || MC.level == null)
91+
return cap;
92+
93+
for(double off = cap; off >= MIN_FALL; off -= SCAN_STEP)
94+
{
95+
AABB box = MC.player.getBoundingBox().move(0, off, 0);
96+
if(MC.level.noCollision(MC.player, box))
97+
return off;
98+
}
99+
100+
return cap;
101+
}
102+
77103
private void sendFakeY(double offset)
78104
{
79105
MC.player.connection

0 commit comments

Comments
 (0)