Skip to content

Commit 3e7d2b4

Browse files
committed
AntiBlast
1 parent e780aa2 commit 3e7d2b4

File tree

6 files changed

+129
-11
lines changed

6 files changed

+129
-11
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ Build without the flag to get the full CevAPI experience; build with the flag fo
262262
- Robust sold-out detection and safe-stop logic to avoid spamming when offers are exhausted.
263263
- Ideal for quickly offloading farmed goods (seeds, string, paper, etc.) into emeralds without manual clicking.
264264

265+
### AntiBlast
266+
- Prevents push back from TNT, creeper explosions, respawn anchors, crystals, wither skulls, wither spawn explosions, ghast fireballs, breeze gusts (and wind charges) and other custom plugins/entities that use explosion physics.
267+
265268
## What’s changed or improved in this fork?
266269

267270
### ItemESP (Expanded)

src/main/java/net/wurstclient/chestsearch/ChestConfig.java

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public class ChestConfig
2626
// a recorded chest
2727
public int scanRadius = 64;
2828

29-
private final File file;
30-
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
29+
private final transient File file;
30+
private final transient Gson gson =
31+
new GsonBuilder().setPrettyPrinting().create();
3132

3233
public ChestConfig(File file)
3334
{
@@ -40,6 +41,30 @@ public ChestConfig()
4041
this(new File("config/wurst/chest_search.json"));
4142
}
4243

44+
private ChestConfigData toData()
45+
{
46+
ChestConfigData data = new ChestConfigData();
47+
data.enabled = enabled;
48+
data.storeFullItemNbt = storeFullItemNbt;
49+
data.dbPath = dbPath;
50+
data.graceTicks = graceTicks;
51+
data.scanRadius = scanRadius;
52+
return data;
53+
}
54+
55+
private void applyData(ChestConfigData data)
56+
{
57+
if(data == null)
58+
return;
59+
60+
enabled = data.enabled;
61+
storeFullItemNbt = data.storeFullItemNbt;
62+
if(data.dbPath != null && !data.dbPath.isBlank())
63+
dbPath = data.dbPath;
64+
graceTicks = data.graceTicks;
65+
scanRadius = data.scanRadius;
66+
}
67+
4368
public synchronized void load()
4469
{
4570
try
@@ -52,13 +77,8 @@ public synchronized void load()
5277
}
5378
try(FileReader r = new FileReader(file))
5479
{
55-
ChestConfig c = gson.fromJson(r, ChestConfig.class);
56-
if(c != null)
57-
{
58-
this.enabled = c.enabled;
59-
this.storeFullItemNbt = c.storeFullItemNbt;
60-
this.dbPath = c.dbPath;
61-
}
80+
ChestConfigData c = gson.fromJson(r, ChestConfigData.class);
81+
applyData(c);
6282
}
6383
}catch(Exception e)
6484
{
@@ -70,10 +90,19 @@ public synchronized void save()
7090
{
7191
try(FileWriter w = new FileWriter(file))
7292
{
73-
gson.toJson(this, w);
93+
gson.toJson(toData(), w);
7494
}catch(Exception e)
7595
{
7696
e.printStackTrace();
7797
}
7898
}
99+
100+
private static class ChestConfigData
101+
{
102+
public boolean enabled = true;
103+
public boolean storeFullItemNbt = true;
104+
public String dbPath = "config/wurst/chest_database.json";
105+
public int graceTicks = 200;
106+
public int scanRadius = 64;
107+
}
79108
}

src/main/java/net/wurstclient/hack/HackList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public final class HackList implements UpdateListener
3434
public final AntiAfkHack antiAfkHack = new AntiAfkHack();
3535
public final AntiBlindHack antiBlindHack = new AntiBlindHack();
3636
public final AntiCactusHack antiCactusHack = new AntiCactusHack();
37-
public final AntiDropHack antiDropHack = new AntiDropHack();
37+
public final AntiDropHack antiDropHack = new AntiDropHack();
38+
public final AntiBlastHack antiBlastHack = new AntiBlastHack();
3839
public final AntiEntityPushHack antiEntityPushHack =
3940
new AntiEntityPushHack();
4041
public final AntiHungerHack antiHungerHack = new AntiHungerHack();
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2014-2025 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.hacks;
9+
10+
import net.minecraft.util.math.Vec3d;
11+
import net.wurstclient.Category;
12+
import net.wurstclient.SearchTags;
13+
import net.wurstclient.hack.Hack;
14+
import net.wurstclient.settings.SliderSetting;
15+
import net.wurstclient.settings.SliderSetting.ValueDisplay;
16+
17+
@SearchTags({"anti explosion", "anti blast", "no explosion knockback",
18+
"no blast knockback", "anti wind charge", "wind charge"})
19+
public final class AntiBlastHack extends Hack
20+
{
21+
private final SliderSetting hStrength =
22+
new SliderSetting("Horizontal Strength",
23+
"How far to reduce horizontal explosion knockback.\n"
24+
+ "-100% = double knockback\n" + "0% = normal knockback\n"
25+
+ "100% = no knockback\n" + ">100% = reverse knockback",
26+
1, -1, 2, 0.01, ValueDisplay.PERCENTAGE);
27+
28+
private final SliderSetting vStrength =
29+
new SliderSetting("Vertical Strength",
30+
"How far to reduce vertical explosion knockback.\n"
31+
+ "-100% = double knockback\n" + "0% = normal knockback\n"
32+
+ "100% = no knockback\n" + ">100% = reverse knockback",
33+
1, -1, 2, 0.01, ValueDisplay.PERCENTAGE);
34+
35+
public AntiBlastHack()
36+
{
37+
super("AntiBlast");
38+
setCategory(Category.COMBAT);
39+
addSetting(hStrength);
40+
addSetting(vStrength);
41+
}
42+
43+
public Vec3d modifyKnockback(double defaultX, double defaultY,
44+
double defaultZ)
45+
{
46+
if(!isEnabled())
47+
return new Vec3d(defaultX, defaultY, defaultZ);
48+
49+
double horizontalMultiplier = 1 - hStrength.getValue();
50+
double verticalMultiplier = 1 - vStrength.getValue();
51+
52+
return new Vec3d(defaultX * horizontalMultiplier,
53+
defaultY * verticalMultiplier, defaultZ * horizontalMultiplier);
54+
}
55+
}

src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
package net.wurstclient.mixin;
99

10+
import java.util.Optional;
11+
1012
import org.spongepowered.asm.mixin.Mixin;
1113
import org.spongepowered.asm.mixin.injection.At;
1214
import org.spongepowered.asm.mixin.injection.Inject;
@@ -15,6 +17,7 @@
1517
import net.minecraft.client.MinecraftClient;
1618
import net.minecraft.client.network.ClientCommonNetworkHandler;
1719
import net.minecraft.client.network.ClientConnectionState;
20+
import net.minecraft.client.network.ClientPlayerEntity;
1821
import net.minecraft.client.network.ClientPlayNetworkHandler;
1922
import net.minecraft.client.toast.SystemToast;
2023
import net.minecraft.network.ClientConnection;
@@ -23,9 +26,11 @@
2326
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
2427
import net.minecraft.network.packet.s2c.play.ChunkData;
2528
import net.minecraft.network.packet.s2c.play.ChunkDeltaUpdateS2CPacket;
29+
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket;
2630
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
2731
import net.minecraft.text.MutableText;
2832
import net.minecraft.text.Text;
33+
import net.minecraft.util.math.Vec3d;
2934
import net.wurstclient.WurstClient;
3035
import net.wurstclient.util.ChatUtils;
3136

@@ -95,4 +100,28 @@ private void onOnChunkDeltaUpdate(ChunkDeltaUpdateS2CPacket packet,
95100
(pos, state) -> WurstClient.INSTANCE.getHax().newChunksHack
96101
.afterUpdateBlock(pos));
97102
}
103+
104+
@Inject(
105+
method = "onExplosion(Lnet/minecraft/network/packet/s2c/play/ExplosionS2CPacket;)V",
106+
at = @At(value = "INVOKE",
107+
target = "Ljava/util/Optional;ifPresent(Ljava/util/function/Consumer;)V"),
108+
cancellable = true)
109+
private void wurst$handleExplosionKnockback(ExplosionS2CPacket packet,
110+
CallbackInfo ci)
111+
{
112+
ClientPlayerEntity player = client.player;
113+
if(player == null)
114+
return;
115+
116+
Optional<Vec3d> knockback = packet.playerKnockback();
117+
if(knockback.isEmpty())
118+
return;
119+
120+
Vec3d vec = knockback.get();
121+
Vec3d adjusted = WurstClient.INSTANCE.getHax().antiBlastHack
122+
.modifyKnockback(vec.x, vec.y, vec.z);
123+
124+
player.addVelocity(adjusted.x, adjusted.y, adjusted.z);
125+
ci.cancel();
126+
}
98127
}

src/main/resources/assets/wurst/translations/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"description.wurst.hack.anticactus": "Protects you from cactus damage.",
2020
"description.wurst.hack.antidrop": "Prevents you from dropping the selected items by accident. Defaults to all weapons, tools, and shulker boxes.",
2121
"description.wurst.hack.antientitypush": "Prevents you from getting pushed by players and mobs.",
22+
"description.wurst.hack.antiblast": "Reduces or reverses knockback from explosions, wind charges, and other blast-based sources.",
2223
"description.wurst.hack.antihunger": "Slows down your hunger when you are walking.\n\n??c??lWARNING:??r There have been reports of this hack causing you to take extra fall damage under specific, unknown conditions.",
2324
"description.wurst.hack.antiknockback": "Prevents you from taking knockback from players and mobs.",
2425
"description.wurst.hack.antisocial": "Automatically disconnects the moment PlayerESP spots someone entering your range, perfect for hiding while AFK farming.",

0 commit comments

Comments
 (0)