@@ -45,6 +45,9 @@ public void move(MovementType movementType, Vec3d movement) {
4545 @ Shadow
4646 public abstract float getYaw ();
4747
48+ /**
49+ * Modifies the player yaw when there is an active rotation to apply the player velocity correctly
50+ */
4851 @ Redirect (method = "updateVelocity" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;getYaw()F" ))
4952 public float velocityYaw (Entity entity ) {
5053 if ((Object ) this != Lambda .getMc ().player ) return getYaw ();
@@ -55,6 +58,14 @@ public float velocityYaw(Entity entity) {
5558 return y ;
5659 }
5760
61+ /**
62+ * Modifies the player yaw for the given tick delta for interpolation when there is an active rotation
63+ * <pre>{@code
64+ * public final Vec3d getRotationVec(float tickDelta) {
65+ * return this.getRotationVector(this.getPitch(tickDelta), this.getYaw(tickDelta));
66+ * }
67+ * }</pre>
68+ */
5869 @ Redirect (method = "getRotationVec" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;getYaw(F)F" ))
5970 float fixDirectionYaw (Entity entity , float tickDelta ) {
6071 Vec2d rot = RotationManager .getRotationForVector (tickDelta );
@@ -63,6 +74,14 @@ float fixDirectionYaw(Entity entity, float tickDelta) {
6374 return (float ) rot .getX ();
6475 }
6576
77+ /**
78+ * Modifies the player pitch for the given tick delta for interpolation when there is an active rotation
79+ * <pre>{@code
80+ * public final Vec3d getRotationVec(float tickDelta) {
81+ * return this.getRotationVector(this.getPitch(tickDelta), this.getYaw(tickDelta));
82+ * }
83+ * }</pre>
84+ */
6685 @ Redirect (method = "getRotationVec" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;getPitch(F)F" ))
6786 float fixDirectionPitch (Entity entity , float tickDelta ) {
6887 Vec2d rot = RotationManager .getRotationForVector (tickDelta );
@@ -71,6 +90,14 @@ float fixDirectionPitch(Entity entity, float tickDelta) {
7190 return (float ) rot .getY ();
7291 }
7392
93+ /**
94+ * Modifies the player yaw for the current rotation yaw
95+ * <pre>{@code
96+ * public Vec3d getRotationVector() {
97+ * return this.getRotationVector(this.getPitch(), this.getYaw());
98+ * }
99+ * }</pre>
100+ */
74101 @ Redirect (method = "getRotationVector()Lnet/minecraft/util/math/Vec3d;" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;getYaw()F" ))
75102 float fixDirectionYaw2 (Entity entity ) {
76103 Vec2d rot = RotationManager .getRotationForVector (1.0 );
@@ -79,6 +106,14 @@ float fixDirectionYaw2(Entity entity) {
79106 return (float ) rot .getX ();
80107 }
81108
109+ /**
110+ * Modifies the player yaw for the current rotation pitch
111+ * <pre>{@code
112+ * public Vec3d getRotationVector() {
113+ * return this.getRotationVector(this.getPitch(), this.getYaw());
114+ * }
115+ * }</pre>
116+ */
82117 @ Redirect (method = "getRotationVector()Lnet/minecraft/util/math/Vec3d;" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/entity/Entity;getPitch()F" ))
83118 float fixDirectionPitch2 (Entity entity ) {
84119 Vec2d rot = RotationManager .getRotationForVector (1.0 );
@@ -95,7 +130,6 @@ private void changeLookDirection(double cursorDeltaX, double cursorDeltaY, Callb
95130 @ Inject (method = "onTrackedDataSet(Lnet/minecraft/entity/data/TrackedData;)V" , at = @ At ("TAIL" ))
96131 public void onTrackedDataSet (TrackedData <?> data , CallbackInfo ci ) {
97132 Entity entity = (Entity ) (Object ) this ;
98-
99133 EventFlow .post (new EntityEvent .EntityUpdate (entity , data ));
100134 }
101135
0 commit comments