# Movement Formulas

Movement formulas applied to a 3b jump.

The player's movement can be accurately calculated with sequences.

The following formulas come from analyzing the game's source code.

Note that these formulas are not exact, due to how floats are computed. When used for calculations, only the first 4-6 decimals should be considered accurate. For a completely accurate simulation, you would need to replicate the source code.

You will find further documentation pertaining to specific mechanics here:

Note: Minecraft's coordinate system is oriented differently: 0° points towards "positive Z", and 90° points towards "negative X". We choose to work in the standard coordinate system to make calculations more intuitive. If need be, we can simply invert the X axis to match Minecraft's coordinate system.

## Vertical Movement

### Jump Formula

• ${\displaystyle V\displaystyle _{Y,1} = 0.42}$
• ${\displaystyle V\displaystyle _{Y,t} = \left (V_{Y,t-1} - \underset{gravity}{0.08} \right ) \times \underset{drag}{0.98}}$

If ${\textstyle \left | V\displaystyle _{Y,t} \right | < 0.005 }$, ${\textstyle V\displaystyle _{Y,t}}$ is set to 0 instead (the player's height doesn't change for that tick)
In 1.9+, it's compared to 0.003 instead.

Notes

• ${\textstyle V\displaystyle _{Y,0}}$ isn't assigned a value because it has no importance. By convention, the 0th tick corresponds to the player's initial velocity before jumping.
• ${\textstyle V\displaystyle _{Y,1}}$ corresponds to the initial jump motion. It is increased by 0.1 per level of Jump Boost
• Terminal velocity is -3.92 m/t
• When the player collides vertically with a block, vertical momentum is cancelled and only the acceleration is left.

### Vertical Position

To get the position on a given tick, you simply need to sum ${\textstyle V\displaystyle _{Y}}$
${\textstyle Y(n) = \sum_{t=1}^{n} V_{Y,t}}$

### Jump duration

The duration of a jump is the number of ticks between jumping and landing.
It also corresponds to the period of that jump's cycle when performed repeatedly.
This notion is linked to the notion of Tiers.
Description Duration
Flat Jump 12 t
3bc Jump 11 t
+0.5 Jump 10 t
+1 Jump 9 t
2.5bc Jump 6 t
2bc Jump 3 t
1.8125bc Jump 2 t

### Source code

from EntityLivingBase

/* Code unrelated to vertical movement is cut out */

protected float getJumpUpwardsMotion(){
return 0.42F;
}

protected void jump()
{
this.motionY = this.getJumpUpwardsMotion();
if (this.isPotionActive(Potion.jump))
{
this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
}
this.isAirBorne = true;
}

public void moveEntityWithHeading(float strafe, float forward)
{
... /* also moves the player horizontally */

this.motionY -= 0.08;
this.motionY *= 0.98;
}

public void onLivingUpdate()
{
if (this.jumpTicks > 0)
--this.jumpTicks;

if (Math.abs(this.motionY) < 0.005D)
this.motionY = 0.0D;

if (this.isJumping)
{
... /* different if in water or lava */

if (this.onGround && this.jumpTicks == 0)
{
this.jump();
this.jumpTicks = 10; //activate autojump cooldown (0.5s)
}
}

else
{
this.jumpTicks = 0; //reset autojump cooldown
}

...

}

## Horizontal Movement

Horizontal Movement is a bit more complex than Vertical Movement, as it relies on many more factors: player actions, direction, and ground slipperiness.

On every tick, the game does these three steps:

1. Acceleration is added to the player's velocity.
2. The player is moved (new position = position + velocity).
3. The player's velocity is reduced to simulate drag.

We'll start by introducing Multipliers in an effort to make formulas more readable.

### Multipliers

Movement Multiplier (See 45° Strafe)

${\displaystyle M_{t} = \begin{Bmatrix}1.3 & \textrm{Sprinting} \\ 1.0 & \textrm{Walking}\\ 0.3 & \textrm{Sneaking}\\ 0.0 & \textrm{Stopping} \end{Bmatrix} \times \begin{Bmatrix}0.98 & \textrm{Default}\\ 1.0 & \textrm{45° Strafe} \\ 0.98 \sqrt{2} & \textrm{45° Sneak} \end{Bmatrix}}$

Effects Multiplier (See Status Effects)

${\displaystyle E_{t} = (\underset{Decreases \; by \; 15\% \; per \; level \; of \; Slowness}{\underset{Increases \; by \; 20\% \; per \; level \; of \; Speed}{\underbrace{\left ( 1 + 0.2\times Speed \right ) \: \times\: \left ( 1 - 0.15\times Slowness \right )}}} \geq 0}$

Slipperiness Multiplier (See Slipperiness)

${\displaystyle S_{t} = \begin{Bmatrix}0.6 & \textrm{Default}\\ 0.8 & \textrm{Slime}\\ 0.98& \textrm{Ice} \\ 1.0 & \textrm{Airborne} \end{Bmatrix}}$

### Linear Formulas

These simplified formulas only apply to linear movement (no change in direction).
While this condition might seem very restrictive, these formulas are very useful to analyze conventional jumps and momentum
We'll later expand on these formulas by including angles.

Definition:
• ${\displaystyle V_{H,0}}$ is the player's initial speed (default = 0).
• ${\textstyle V_{H,t}}$ is the player's speed on tick ${\textstyle t}$.

Ground Speed:
${\displaystyle V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} }$

Jump Speed:
${\displaystyle V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} + \underset{Sprintjump \; Boost}{\underbrace{\begin{Bmatrix}0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} }}}$

Air Speed:
${\displaystyle V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{\underset{ }{0.02 \times M_{t}}}} }$

### Complete Formulas

Let's introduce two more variables:
• ${\textstyle D_{t} }$ , The player's Direction in degrees (defined by their inputs and rotation)
• ${\textstyle F_{t} }$ , The player's Facing in degrees (defined by their rotation only)

In reality, angles aren't as simple as that, as there are a limited number of significant angles (see Facing and Angles).

For the purpose of simplicity, we'll ignore this fact.

Definition:
• ${\textstyle V_{X,0}}$ and ${\textstyle V_{Z,0}}$ correspond to the player's initial velocity.
• ${\textstyle V_{X,t}}$ and ${\textstyle V_{Z,t}}$ correspond to the player's velocity on tick ${\textstyle t}$
Ground Velocity:
${\displaystyle V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) }$
${\displaystyle V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) }$
Jump Velocity:
${\displaystyle V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) + \begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \sin (F_{t}) }$
${\displaystyle V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) + \underset{Sprintjump \; Boost }{\underbrace{\begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \cos (F_{t})}} }$

Air Velocity:
${\displaystyle V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.02 \times M_{t} \times \sin (D_{t}) }$
${\displaystyle V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{\underset{}{0.02 \times M_{t}}}} \times \cos (D_{t}) }$

### Stopping Conditions

Horizontal speed is set to 0 if the player hits a wall, or if the speed is considered to be negligible.

Wall Collision:
If the player hits a X-facing wall, then ${\textstyle V\displaystyle _{X,t}}$ is set to 0 and the player is placed against the wall.
If the player hits a Z-facing wall, then ${\textstyle V\displaystyle _{Z,t}}$ is set to 0 and the player is placed against the wall.

Negligible Speed Threshold:
If ${\textstyle \left | V\displaystyle _{X,t} \times S_{t} \times 0.91 \right | < 0.005 }$ , momentum is cancelled and only the acceleration is left.
If ${\textstyle \left | V\displaystyle _{Z,t} \times S_{t} \times 0.91 \right | < 0.005 }$ , momentum is cancelled and only the acceleration is left.
In 1.9+, they are compared to 0.003 instead.

[...]

## Non-Recursive Formulas

Since arithmetico-geometric sequences have explicit formulas, we can build non-recursive formulas to calculate simple but useful results, such as the height of the player on any given tick, or the distance of a jump in terms of the initial speed and duration.

Numeric approximations are given with 6 digits of precision.

Definitions:

• ${\textstyle v_0}$ is the player's initial speed (speed on ${\displaystyle t_0}$, before jumping)
• ${\textstyle t}$ is the number of ticks considered (ex: t=12 on flat ground, see Jump Duration)
• ${\textstyle J}$ is the "jump bonus" (0.3274 for sprintjump, 0.291924 for strafed sprintjump, 0.1 for 45° no-sprint jump...)
• ${\textstyle M}$ is the movement multiplier after jumping (1.3 for 45° sprint, 1.274 for normal sprint, 1.0 for no-sprint 45°...)

### Vertical Movement (jump) [1.8]

Vertical speed after jumping (${\displaystyle t \geq 6}$)

${\textstyle \textrm{V}_Y(t) = 4 \times 0.98^{t-5} - 3.92}$

Relative height after jumping (${\displaystyle t \geq 6}$)

${\textstyle \textrm{Y}_{rel}(t) = \underset{\textrm{jump peak}}{\underbrace{197.4 - 217 \times 0.98^5}} + 200 (0.98-0.98^{t-4}) - 3.92 (t-5)}$
num. approx: ${\displaystyle \textrm{Y}_{rel}(t) \approx 216.849187 - 216.833157 \times 0.98^t - 3.92t}$

For ${\textstyle t<6}$, see below.

### Vertical Movement (jump) [1.9+]

Vertical speed after jumping (${\displaystyle t \geq 1}$)

${\textstyle \textrm{V}_Y(t) = 0.42 \times 0.98^{t-1} + 4 \times 0.98^t - 3.92}$
num. approx: ${\displaystyle \textrm{V}_Y(t) \approx 4.428571 \times 0.98^t - 3.92}$

Relative height after jumping (${\displaystyle t \geq 0}$)

${\textstyle \textrm{Y}_{rel}(t) = 217 \times (1 - 0.98^t) - 3.92 t}$

### Horizontal Movement (instant jump)

Assuming the player was airborne before jumping.

Horizontal speed after sprintjumping (${\displaystyle t \geq 2}$)

${\textstyle \textrm{V}_H(v_0,t) = \frac{0.02 M}{0.09} + 0.6 \times 0.91^t \times \left ( v_0 + \frac{J}{0.91} - \frac{0.02 M}{0.6 \times 0.91 \times 0.09} \right )}$
45° sprint: ${\displaystyle \textrm{V}_H(v_0,t) \approx 0.288889 + 0.6 \times 0.91^t \times \left ( v_0 - 0.169320 \right )}$
reg. sprint: ${\textstyle \textrm{V}_H(v_0,t) \approx 0.283111 + 0.6 \times 0.91^t \times \left ( v_0 - 0.158738 \right )}$

Sprintjump distance (${\displaystyle t \geq 2}$)

${\textstyle \textrm{Dist}(v_0,t) = 1.91 v_0 + J + \frac{0.02 M}{0.09} (t-2) + \frac{0.6 \times 0.91^2}{0.09} \times (1 - 0.91^{t-2}) \times \left ( v_0 + \frac{J}{0.91} - \frac{0.02 M}{0.6 \times 0.91 \times 0.09} \right )}$
45° sprint: ${\textstyle \textrm{Dist}(v_0,t) \approx 7.430667 v_0 + 0.288889 t -1.185138 - 6.666667 \times 0.91^t \left ( v_0 - 0.169320 \right )}$
reg. sprint: ${\textstyle \textrm{Dist}(v_0,t) \approx 7.430667 v_0 + 0.283111 t -1.115163 - 6.666667 \times 0.91^t \left ( v_0 - 0.158738 \right )}$

Note: These formulas are accurate for most values of ${\displaystyle v_0}$, but some negative values can wind up activating the speed threshold and reset the player's speed at some point, thus rendering these formulas inaccurate.

### Horizontal Movement (delayed jump)

Assuming the player is on ground before jumping (at least 1 tick since landing).

Horizontal speed after sprintjumping (${\displaystyle t \geq 2}$)

${\textstyle \textrm{V}^*_H(v_0,t) = \frac{0.02 M}{0.09} + 0.6 \times 0.91^t \times \left ( 0.6 v_0 + \frac{J}{0.91} - \frac{0.02 M}{0.6 \times 0.91 \times 0.09} \right )}$
45° sprint: ${\displaystyle \textrm{V}^*_H(v_0,t) \approx 0.288889 + 0.36 \times 0.91^t \times \left ( v_0 -0.282201 \right )}$
reg. sprint: ${\textstyle \textrm{V}^*_H(v_0,t) \approx 0.283111 + 0.36 \times 0.91^t \times \left ( v_0 - 0.264563 \right )}$

Sprintjump distance (${\displaystyle t \geq 2}$)

${\textstyle \textrm{Dist}^*(v_0,t) = 1.546 v_0 + J + \frac{0.02 M}{0.09} (t-2) + \frac{0.6 \times 0.91^2}{0.09} \times (1 - 0.91^{t-2}) \times \left ( 0.6v_0 + \frac{J}{0.91} - \frac{0.02 M}{0.6 \times 0.91 \times 0.09} \right )}$
45° sprint: ${\textstyle \textrm{Dist}^*(v_0,t) \approx 4.8584 v_0 + 0.288889t -1.185138 + 4 \times 0.91^t (v_0 - 0.169320)}$
reg. sprint: ${\textstyle \textrm{Dist}^*(v_0,t) \approx 4.8584 v_0 + 0.283111t -1.115163 + 4 \times 0.91^t (v_0 - 0.158738)}$

Horizontal speed after ${\displaystyle n}$ consecutive sprintjumps on a momentum of period ${\textstyle T}$ (${\displaystyle n \geq 0}$, ${\displaystyle T \geq 2}$).

If the first sprintjump is delayed, multiply ${\textstyle v_0}$ by 0.6

${\textstyle \textrm{V}^{\,n}_H(v_0,T,n) = \left ( 0.6 \times 0.91^T \right )^n v_0 + \left ( 0.6 \times 0.91^{T-1} J + 0.02M \frac{1 - 0.91^{T-1}}{0.09} \right ) \frac{1- (0.6 \times 0.91^T)^n}{1 - 0.6 \times 0.91^T} }$

### Examples

• ${\displaystyle Y_{rel}(60) }$ gives the relative height of the player 3 seconds (60 ticks) after jumping.
• ${\displaystyle \textrm{Dist}(0,12)}$ gives the jump distance on flat ground with no initial speed.
• ${\displaystyle \textrm{Dist}( V_H(0,12) ,9)}$ gives the distance of a +1 jump with one sprintjump of flat momentum as initial speed.
• ${\displaystyle \textrm{Dist}(V^{10}_H(0,2), 12) }$ gives the jump distance with 10 sprintjumps of momentum under a trapdoor-headhitter.