@@ -30,27 +30,37 @@ class CorrectPlayerMovePredictionPacket extends DataPacket implements Clientboun
30
30
private int $ tick ;
31
31
private int $ predictionType ;
32
32
private ?Vector2 $ vehicleRotation ;
33
+ private ?float $ vehicleAngularVelocity ;
33
34
34
35
/**
35
36
* @generate-create-func
36
37
*/
37
- private static function internalCreate (Vector3 $ position , Vector3 $ delta , bool $ onGround , int $ tick , int $ predictionType , ?Vector2 $ vehicleRotation ) : self {
38
+ private static function internalCreate (
39
+ Vector3 $ position ,
40
+ Vector3 $ delta ,
41
+ bool $ onGround ,
42
+ int $ tick ,
43
+ int $ predictionType ,
44
+ ?Vector2 $ vehicleRotation ,
45
+ ?float $ vehicleAngularVelocity ,
46
+ ) : self {
38
47
$ result = new self ;
39
48
$ result ->position = $ position ;
40
49
$ result ->delta = $ delta ;
41
50
$ result ->onGround = $ onGround ;
42
51
$ result ->tick = $ tick ;
43
52
$ result ->predictionType = $ predictionType ;
44
53
$ result ->vehicleRotation = $ vehicleRotation ;
54
+ $ result ->vehicleAngularVelocity = $ vehicleAngularVelocity ;
45
55
return $ result ;
46
56
}
47
57
48
- public static function create (Vector3 $ position , Vector3 $ delta , bool $ onGround , int $ tick , int $ predictionType , ?Vector2 $ vehicleRotation ) : self {
58
+ public static function create (Vector3 $ position , Vector3 $ delta , bool $ onGround , int $ tick , int $ predictionType , ?Vector2 $ vehicleRotation, ? float $ vehicleAngularVelocity ) : self {
49
59
if ($ predictionType === self ::PREDICTION_TYPE_VEHICLE && $ vehicleRotation === null ){
50
60
throw new \LogicException ("CorrectPlayerMovePredictionPackets with type VEHICLE require a vehicleRotation to be provided " );
51
61
}
52
62
53
- return self ::internalCreate ($ position , $ delta , $ onGround , $ tick , $ predictionType , $ vehicleRotation );
63
+ return self ::internalCreate ($ position , $ delta , $ onGround , $ tick , $ predictionType , $ vehicleRotation, $ vehicleAngularVelocity );
54
64
}
55
65
56
66
public function getPosition () : Vector3 { return $ this ->position ; }
@@ -65,12 +75,15 @@ public function getPredictionType() : int{ return $this->predictionType; }
65
75
66
76
public function getVehicleRotation () : ?Vector2 { return $ this ->vehicleRotation ; }
67
77
78
+ public function getVehicleAngularVelocity () : ?float { return $ this ->vehicleAngularVelocity ; }
79
+
68
80
protected function decodePayload (PacketSerializer $ in ) : void {
69
81
$ this ->predictionType = $ in ->getByte ();
70
82
$ this ->position = $ in ->getVector3 ();
71
83
$ this ->delta = $ in ->getVector3 ();
72
84
if ($ this ->predictionType === self ::PREDICTION_TYPE_VEHICLE ){
73
85
$ this ->vehicleRotation = new Vector2 ($ in ->getFloat (), $ in ->getFloat ());
86
+ $ this ->vehicleAngularVelocity = $ in ->readOptional ($ in ->getFloat (...));
74
87
}
75
88
$ this ->onGround = $ in ->getBool ();
76
89
$ this ->tick = $ in ->getUnsignedVarLong ();
@@ -87,6 +100,7 @@ protected function encodePayload(PacketSerializer $out) : void{
87
100
88
101
$ out ->putFloat ($ this ->vehicleRotation ->getX ());
89
102
$ out ->putFloat ($ this ->vehicleRotation ->getY ());
103
+ $ out ->writeOptional ($ this ->vehicleAngularVelocity , $ out ->putFloat (...));
90
104
}
91
105
$ out ->putBool ($ this ->onGround );
92
106
$ out ->putUnsignedVarLong ($ this ->tick );
0 commit comments