77
88import meteordevelopment .meteorclient .events .packets .PacketEvent ;
99import meteordevelopment .meteorclient .events .world .TickEvent ;
10- import meteordevelopment .meteorclient .settings .BoolSetting ;
11- import meteordevelopment .meteorclient .settings .KeybindSetting ;
12- import meteordevelopment .meteorclient .settings .Setting ;
13- import meteordevelopment .meteorclient .settings .SettingGroup ;
10+ import meteordevelopment .meteorclient .settings .*;
1411import meteordevelopment .meteorclient .systems .modules .Categories ;
1512import meteordevelopment .meteorclient .systems .modules .Module ;
1613import meteordevelopment .meteorclient .utils .Utils ;
1714import meteordevelopment .meteorclient .utils .entity .fakeplayer .FakePlayerEntity ;
1815import meteordevelopment .meteorclient .utils .misc .Keybind ;
1916import meteordevelopment .orbit .EventHandler ;
2017import net .minecraft .network .packet .c2s .play .PlayerMoveC2SPacket ;
18+ import net .minecraft .util .math .Vec3d ;
2119import org .joml .Vector3d ;
2220
2321import java .util .ArrayList ;
@@ -33,6 +31,15 @@ public class Blink extends Module {
3331 .build ()
3432 );
3533
34+ private final Setting <Integer > delay = sgGeneral .add (new IntSetting .Builder ()
35+ .name ("pulse-delay" )
36+ .description ("After the duration in ticks has elapsed, send all packets and start blinking again. 0 to disable." )
37+ .defaultValue (0 )
38+ .min (0 )
39+ .sliderMax (60 )
40+ .build ()
41+ );
42+
3643 @ SuppressWarnings ("unused" )
3744 private final Setting <Keybind > cancelBlink = sgGeneral .add (new KeybindSetting .Builder ()
3845 .name ("cancel-blink" )
@@ -49,7 +56,7 @@ public class Blink extends Module {
4956 private FakePlayerEntity model ;
5057 private final Vector3d start = new Vector3d ();
5158
52- private boolean cancelled = false ;
59+ private boolean cancelled , sending ;
5360 private int timer = 0 ;
5461
5562 public Blink () {
@@ -62,6 +69,7 @@ public void onActivate() {
6269 model = new FakePlayerEntity (mc .player , mc .player .getGameProfile ().getName (), 20 , true );
6370 model .doNotPush = true ;
6471 model .hideWhenInsideCamera = true ;
72+ model .noHit = true ;
6573 model .spawn ();
6674 }
6775
@@ -71,17 +79,28 @@ public void onActivate() {
7179 @ Override
7280 public void onDeactivate () {
7381 dumpPackets (!cancelled );
74- if (cancelled ) mc .player .setPos (start .x , start .y , start .z );
82+
83+ if (cancelled ) {
84+ mc .player .setPos (start .x , start .y , start .z );
85+ mc .player .setVelocity (Vec3d .ZERO );
86+ }
87+
7588 cancelled = false ;
7689 }
7790
7891 @ EventHandler
7992 private void onTick (TickEvent .Post event ) {
8093 timer ++;
94+
95+ if (delay .get () != 0 && delay .get () <= timer ) {
96+ onDeactivate ();
97+ onActivate ();
98+ }
8199 }
82100
83101 @ EventHandler
84102 private void onSendPacket (PacketEvent .Send event ) {
103+ if (sending ) return ;
85104 if (!(event .packet instanceof PlayerMoveC2SPacket p )) return ;
86105 event .cancel ();
87106
@@ -107,10 +126,12 @@ public String getInfoString() {
107126 }
108127
109128 private void dumpPackets (boolean send ) {
129+ sending = true ;
110130 synchronized (packets ) {
111131 if (send ) packets .forEach (mc .player .networkHandler ::sendPacket );
112132 packets .clear ();
113133 }
134+ sending = false ;
114135
115136 if (model != null ) {
116137 model .despawn ();
0 commit comments