Skip to content

Commit fc207bf

Browse files
committed
Advanced Flight and NoFall
1 parent 39511b9 commit fc207bf

5 files changed

Lines changed: 1263 additions & 29 deletions

File tree

src/main/java/net/wurstclient/Category.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public enum Category
1212
FAVORITES("Favorites"),
1313
BLOCKS("Blocks"),
1414
MOVEMENT("Movement"),
15+
PLAYER("Player"),
1516
COMBAT("Combat"),
1617
RENDER("Render"),
1718
CHAT("Chat"),

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

Lines changed: 175 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,28 @@
1313
import net.wurstclient.SearchTags;
1414
import net.wurstclient.events.AirStrafingSpeedListener;
1515
import net.wurstclient.events.IsPlayerInWaterListener;
16+
import net.wurstclient.events.PacketInputListener;
17+
import net.wurstclient.events.PacketInputListener.PacketInputEvent;
18+
import net.wurstclient.events.PostMotionListener;
19+
import net.wurstclient.events.PreMotionListener;
1620
import net.wurstclient.events.UpdateListener;
1721
import net.wurstclient.hack.Hack;
1822
import net.wurstclient.settings.CheckboxSetting;
23+
import net.wurstclient.settings.EnumSetting;
1924
import net.wurstclient.settings.SliderSetting;
2025
import net.wurstclient.settings.SliderSetting.ValueDisplay;
26+
import net.wurstclient.util.ChatUtils;
27+
import net.wurstclient.util.timer.TimerPriority;
28+
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
2129

2230
@SearchTags({"FlyHack", "fly hack", "flying"})
23-
public final class FlightHack extends Hack
24-
implements UpdateListener, IsPlayerInWaterListener, AirStrafingSpeedListener
31+
public final class FlightHack extends Hack implements UpdateListener,
32+
IsPlayerInWaterListener, AirStrafingSpeedListener, PacketInputListener,
33+
PreMotionListener, PostMotionListener
2534
{
35+
private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
36+
"description.wurst.setting.flight.mode", Mode.values(), Mode.VANILLA);
37+
2638
public final SliderSetting horizontalSpeed = new SliderSetting(
2739
"Horizontal Speed", 1, 0.05, 10, 0.05, ValueDisplay.DECIMAL);
2840

@@ -36,6 +48,23 @@ public final class FlightHack extends Hack
3648
"Reduces your horizontal speed while you are sneaking to prevent you from glitching out.",
3749
true);
3850

51+
private final CheckboxSetting stride = new CheckboxSetting("Stride",
52+
"description.wurst.setting.flight.stride", true);
53+
54+
private final CheckboxSetting disableOnSetback =
55+
new CheckboxSetting("DisableOnSetback",
56+
"description.wurst.setting.flight.disable_on_setback", false);
57+
58+
private final CheckboxSetting cycleOnSetback =
59+
new CheckboxSetting("CycleOnSetback",
60+
"description.wurst.setting.flight.cycle_on_setback", false);
61+
62+
private final SliderSetting grimTimer = new SliderSetting("Grim Timer",
63+
0.446, 0.1, 1, 0.001, ValueDisplay.DECIMAL);
64+
65+
private final SliderSetting grimToggle =
66+
new SliderSetting("Grim Toggle", 0, 0, 100, 1, ValueDisplay.INTEGER);
67+
3968
private final CheckboxSetting antiKick = new CheckboxSetting("Anti-Kick",
4069
"Makes you fall a little bit every now and then to prevent you from getting kicked.",
4170
false);
@@ -54,14 +83,23 @@ public final class FlightHack extends Hack
5483
0.07, 0.01, 0.2, 0.001, ValueDisplay.DECIMAL.withSuffix("m"));
5584

5685
private int tickCounter = 0;
86+
private long lastSetbackMs;
87+
private int grimTicks;
88+
private Vec3 grimPos;
5789

5890
public FlightHack()
5991
{
6092
super("Flight");
6193
setCategory(Category.MOVEMENT);
94+
addSetting(mode);
6295
addSetting(horizontalSpeed);
6396
addSetting(verticalSpeed);
6497
addSetting(slowSneaking);
98+
addSetting(stride);
99+
addSetting(disableOnSetback);
100+
addSetting(cycleOnSetback);
101+
addSetting(grimTimer);
102+
addSetting(grimToggle);
65103
addSetting(antiKick);
66104
addSetting(antiKickInterval);
67105
addSetting(antiKickDistance);
@@ -78,6 +116,9 @@ protected void onEnable()
78116
EVENTS.add(UpdateListener.class, this);
79117
EVENTS.add(IsPlayerInWaterListener.class, this);
80118
EVENTS.add(AirStrafingSpeedListener.class, this);
119+
EVENTS.add(PacketInputListener.class, this);
120+
EVENTS.add(PreMotionListener.class, this);
121+
EVENTS.add(PostMotionListener.class, this);
81122
}
82123

83124
@Override
@@ -86,12 +127,36 @@ protected void onDisable()
86127
EVENTS.remove(UpdateListener.class, this);
87128
EVENTS.remove(IsPlayerInWaterListener.class, this);
88129
EVENTS.remove(AirStrafingSpeedListener.class, this);
130+
EVENTS.remove(PacketInputListener.class, this);
131+
EVENTS.remove(PreMotionListener.class, this);
132+
EVENTS.remove(PostMotionListener.class, this);
133+
134+
grimTicks = 0;
135+
grimPos = null;
89136
}
90137

91138
@Override
92139
public void onUpdate()
93140
{
94141
LocalPlayer player = MC.player;
142+
if(player == null)
143+
return;
144+
145+
if(mode.getSelected() == Mode.GRIM_2859_V)
146+
{
147+
if(grimTicks == 0)
148+
player.jumpFromGround();
149+
150+
if(grimTicks <= 5)
151+
WURST.getTimerManager().requestTimerSpeed(grimTimer.getValueF(),
152+
TimerPriority.IMPORTANT_FOR_USAGE_2, this, 1);
153+
154+
if(grimToggle.getValueI() != 0
155+
&& grimTicks >= grimToggle.getValueI())
156+
setEnabled(false);
157+
158+
grimTicks++;
159+
}
95160

96161
player.getAbilities().flying = false;
97162

@@ -118,6 +183,9 @@ public void onGetAirStrafingSpeed(AirStrafingSpeedEvent event)
118183
if(MC.options.keyShift.isDown() && slowSneaking.isChecked())
119184
speed = Math.min(speed, 0.85F);
120185

186+
if(stride.isChecked())
187+
speed = Math.max(speed, 0.1F);
188+
121189
event.setSpeed(speed);
122190
}
123191

@@ -149,4 +217,109 @@ public void onIsPlayerInWater(IsPlayerInWaterEvent event)
149217
{
150218
event.setInWater(false);
151219
}
220+
221+
@Override
222+
public void onReceivedPacket(PacketInputEvent event)
223+
{
224+
if(event.getPacket() instanceof ClientboundPlayerPositionPacket)
225+
{
226+
long now = System.currentTimeMillis();
227+
if(now - lastSetbackMs < 1000)
228+
return;
229+
230+
lastSetbackMs = now;
231+
232+
if(cycleOnSetback.isChecked())
233+
{
234+
Mode next = mode.getSelected().next();
235+
mode.setSelected(next);
236+
ChatUtils.error(WURST
237+
.translate("message.wurst.flight.setback_cycle", next));
238+
return;
239+
}
240+
241+
if(disableOnSetback.isChecked())
242+
{
243+
ChatUtils.error(
244+
WURST.translate("message.wurst.flight.setback_detected"));
245+
setEnabled(false);
246+
}
247+
}
248+
}
249+
250+
@Override
251+
public void onPreMotion()
252+
{
253+
if(mode.getSelected() != Mode.GRIM_2859_V)
254+
return;
255+
256+
LocalPlayer player = MC.player;
257+
if(player == null)
258+
return;
259+
260+
if(grimTicks >= 2)
261+
{
262+
grimPos = player.position();
263+
player.setPos(grimPos.x + 1152, grimPos.y, grimPos.z + 1152);
264+
}
265+
}
266+
267+
@Override
268+
public void onPostMotion()
269+
{
270+
if(mode.getSelected() != Mode.GRIM_2859_V)
271+
return;
272+
273+
LocalPlayer player = MC.player;
274+
if(player == null || grimPos == null)
275+
return;
276+
277+
player.setPos(grimPos.x, grimPos.y, grimPos.z);
278+
}
279+
280+
public enum Mode
281+
{
282+
VANILLA("Vanilla"),
283+
CREATIVE("Creative"),
284+
JETPACK("Jetpack"),
285+
ENDERPEARL("Enderpearl"),
286+
AIR_WALK("AirWalk"),
287+
EXPLOSION("Explosion"),
288+
FIREBALL("Fireball"),
289+
VULCAN_277("Vulcan277"),
290+
VULCAN_286("Vulcan286"),
291+
VULCAN_286_MC_18("Vulcan286-18"),
292+
VULCAN_286_TELEPORT("Vulcan286-Teleport-18"),
293+
GRIM_2859_V("Grim2859-V"),
294+
SPARTAN_524("Spartan524"),
295+
SENTINEL_20TH_APR("Sentinel20thApr"),
296+
SENTINEL_27TH_JAN("Sentinel27thJan"),
297+
SENTINEL_10TH_MAR("Sentinel10thMar"),
298+
VERUS_B3896_DAMAGE("VerusB3896Damage"),
299+
VERUS_B3869_FLAT("VerusB3869Flat"),
300+
NCP_CLIP("NcpClip"),
301+
HYPIXEL("Hypixel"),
302+
HYPIXEL_FLAT("HypixelFlat"),
303+
HYCRAFT_DAMAGE("HycraftDamage");
304+
305+
private final String name;
306+
307+
Mode(String name)
308+
{
309+
this.name = name;
310+
}
311+
312+
@Override
313+
public String toString()
314+
{
315+
return name;
316+
}
317+
318+
public Mode next()
319+
{
320+
Mode[] values = values();
321+
int nextIndex = (ordinal() + 1) % values.length;
322+
return values[nextIndex];
323+
}
324+
}
152325
}

0 commit comments

Comments
 (0)