20
20
import static dev .dfonline .codeclient .CodeClient .MC ;
21
21
22
22
@ Mixin (ClientPlayerEntity .class )
23
- public class MClientPlayerEntity {
23
+ public abstract class MClientPlayerEntity {
24
24
@ Shadow @ Final public ClientPlayNetworkHandler networkHandler ;
25
25
26
26
private boolean lastSneaking = false ;
@@ -38,7 +38,29 @@ private void sendMovementPackets(CallbackInfo ci) {
38
38
if (NoClip .isIgnoringWalls ()) {
39
39
ci .cancel ();
40
40
Vec3d pos = NoClip .handleSeverPosition ();
41
- this .networkHandler .sendPacket (new PlayerMoveC2SPacket .Full (pos .x , pos .y , pos .z , player .getYaw (), player .getPitch (), false ));
41
+ boolean idle = NoClip .timesSinceMoved ++ > 40 ;
42
+ if (idle ) NoClip .timesSinceMoved = 0 ;
43
+ float yaw = player .getYaw ();
44
+ float pitch = player .getPitch ();
45
+ boolean rotation = pitch != NoClip .lastPitch || yaw != NoClip .lastYaw ;
46
+ boolean position = !pos .equals (NoClip .lastPos ) || idle ;
47
+ if (position || rotation ) {
48
+ if (position ) {
49
+ NoClip .timesSinceMoved = 0 ;
50
+ if (rotation ) {
51
+ this .networkHandler .sendPacket (new PlayerMoveC2SPacket .Full (pos .x , pos .y , pos .z , yaw , pitch , false ));
52
+ }
53
+ else {
54
+ this .networkHandler .sendPacket (new PlayerMoveC2SPacket .PositionAndOnGround (pos .x , pos .y , pos .z , false ));
55
+ }
56
+ }
57
+ else {
58
+ this .networkHandler .sendPacket (new PlayerMoveC2SPacket .LookAndOnGround (yaw , pitch , false ));
59
+ }
60
+ }
61
+ NoClip .lastPos = pos ;
62
+ NoClip .lastYaw = yaw ;
63
+ NoClip .lastPitch = pitch ;
42
64
}
43
65
boolean sneaking = player .isSneaking ();
44
66
if (sneaking != this .lastSneaking ) {
0 commit comments