File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
src/main/java/doggytalents/common/entity Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1120,12 +1120,18 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) {
11201120
11211121 @ Override
11221122 public void calculateEntityAnimation (boolean ySpeed ) {
1123- float rawDeltaMove = (float ) Mth .length (
1124- this .getX () - this .xo ,
1125- 0 ,
1126- this .getZ () - this .zo
1127- );
1128- this .updateWalkAnimation (rawDeltaMove );
1123+ double dx = this .getX () - this .xo ;
1124+ double dz = this .getZ () - this .zo ;
1125+ float l_xz = (float ) Mth .length (dx , dz );
1126+
1127+ float yrot = this .getYRot () * Mth .DEG_TO_RAD ;
1128+ float look_x = -Mth .sin (yrot );
1129+ float look_z = Mth .cos (yrot );
1130+
1131+ float voluntary_spped = (float ) (dx * look_x + dz * look_z );
1132+ voluntary_spped = Mth .clamp (voluntary_spped , 0 , l_xz );
1133+
1134+ this .updateWalkAnimation (voluntary_spped );
11291135 }
11301136
11311137 @ Override
You can’t perform that action at this time.
0 commit comments