Skip to content

Player Movement

Player movement is controlled through the MovementManager component, which holds a MovementSettings instance with 61 configurable parameters.

MovementManager movement = store.getComponent(ref, MovementManager.getComponentType());
MovementSettings settings = movement.getSettings();

See Entity Components for details on store and component access patterns.

MovementSettings settings = movement.getSettings();
settings.canFly = true;
// send to client
Player player = store.getComponent(ref, Player.getComponentType());
movement.update(player.getPlayerRef().getPacketHandler());
MovementSettings settings = movement.getSettings();
// base walking speed (default: 5.5)
settings.baseSpeed = 8.0f;
// sprint multiplier (default: 1.65)
settings.forwardSprintSpeedMultiplier = 2.0f;
movement.update(player.getPlayerRef().getPacketHandler());
MovementSettings settings = movement.getSettings();
// jump force (default: 11.8)
settings.jumpForce = 20.0f;
movement.update(player.getPlayerRef().getPacketHandler());
// reset to world defaults and sync to client
movement.resetDefaultsAndUpdate(ref, store);
// or reset without syncing
movement.applyDefaultSettings();

To check what a player is currently doing (flying, sprinting, crouching, etc.), read the MovementStatesComponent:

MovementStatesComponent statesComponent = store.getComponent(ref,
MovementStatesComponent.getComponentType());
MovementStates states = statesComponent.getMovementStates();
if (states.flying) {
// player is currently in flight
}
if (states.sprinting) {
// player is sprinting
}

All fields are public booleans on MovementStates:

FieldDescription
idleNot moving
horizontalIdleNo horizontal movement
jumpingCurrently jumping
flyingCurrently in flight
walkingWalking (slow movement)
runningRunning (normal movement)
sprintingSprinting (fast movement)
crouchingCrouching
forcedCrouchingForced crouch (e.g., under low ceiling)
fallingFalling
climbingClimbing a surface
inFluidIn fluid (water/lava)
swimmingSwimming
swimJumpingJumping while swimming
onGroundOn solid ground
mantlingMantling an edge
slidingSliding
mountingMounting an entity
rollingRolling
sittingSitting
glidingGliding
sleepingSleeping

All fields are public and directly modifiable on MovementSettings.

FieldDefaultDescription
baseSpeed5.5Base movement speed
acceleration0.1Movement acceleration
forwardRunSpeedMultiplier1.0Forward run speed multiplier
backwardRunSpeedMultiplier0.65Backward run speed multiplier
strafeRunSpeedMultiplier0.8Strafe run speed multiplier
forwardSprintSpeedMultiplier1.65Sprint speed multiplier
forwardWalkSpeedMultiplier0.3Walk speed multiplier
backwardWalkSpeedMultiplier0.3Backward walk multiplier
strafeWalkSpeedMultiplier0.3Strafe walk multiplier
forwardCrouchSpeedMultiplier0.55Crouch speed multiplier
backwardCrouchSpeedMultiplier0.4Backward crouch multiplier
strafeCrouchSpeedMultiplier0.45Strafe crouch multiplier
FieldDefaultDescription
jumpForce11.8Jump force
swimJumpForce10.0Jump force while swimming
fallJumpForce7.0Jump force when falling
jumpBufferDuration0.3Jump buffer window (seconds)
jumpBufferMaxYVelocity3.0Max Y velocity for jump buffer
variableJumpFallForce35.0Fall force for variable jump height
FieldDefaultDescription
canFlyfalse*Whether player can fly (*true in Creative)
horizontalFlySpeed10.32Horizontal flight speed
verticalFlySpeed10.32Vertical flight speed
FieldDefaultDescription
airSpeedMultiplier1.0Air movement speed multiplier
airDragMin0.96Minimum air drag
airDragMax0.995Maximum air drag
airDragMinSpeed6.0Speed for minimum drag
airDragMaxSpeed10.0Speed for maximum drag
airFrictionMin0.02Minimum air friction
airFrictionMax0.045Maximum air friction
airFrictionMinSpeed6.0Speed for minimum friction
airFrictionMaxSpeed10.0Speed for maximum friction
airControlMinSpeed0.0Speed for minimum air control
airControlMaxSpeed3.0Speed for maximum air control
airControlMinMultiplier0.0Minimum air control
airControlMaxMultiplier3.13Maximum air control
comboAirSpeedMultiplier1.05Air speed during combos
FieldDefaultDescription
climbSpeed0.035Climb speed
climbSpeedLateral0.035Lateral climb speed
climbUpSprintSpeed0.045Sprint climb up speed
climbDownSprintSpeed0.055Sprint climb down speed
FieldDefaultDescription
minSlideEntrySpeed8.5Minimum speed to start sliding
slideExitSpeed2.5Speed at which slide ends
FieldDefaultDescription
minFallSpeedToEngageRoll21.0Minimum fall speed to trigger roll
maxFallSpeedToEngageRoll31.0Maximum fall speed for roll
rollStartSpeedModifier2.5Speed modifier at roll start
rollExitSpeedModifier1.5Speed modifier at roll exit
rollTimeToComplete0.9Roll duration (seconds)
FieldDefaultDescription
autoJumpDisableJumpingtrueDisable manual jump during auto-jump
autoJumpObstacleSpeedLoss0.95Speed loss on auto-jump
autoJumpObstacleSprintSpeedLoss0.75Speed loss when sprinting
autoJumpObstacleEffectDuration0.2Effect duration (seconds)
autoJumpObstacleSprintEffectDuration0.1Sprint effect duration (seconds)
autoJumpObstacleMaxAngle45.0Maximum angle for auto-jump
FieldDefaultDescription
mass1.0Player mass (from PhysicsValues)
dragCoefficient0.5Drag coefficient (from PhysicsValues)
invertedGravityfalseInvert gravity (from PhysicsValues)
velocityResistance0.242Velocity resistance
collisionExpulsionForce0.04Force when colliding
FieldDefaultDescription
fallEffectDuration0.6Fall effect duration (seconds)
fallMomentumLoss0.1Momentum loss on landing

Movement prediction parameters for client-side smoothing.

FieldDefaultDescription
wishDirectionGravityX0.5Horizontal direction gravity
wishDirectionGravityY0.5Vertical direction gravity
wishDirectionWeightX0.5Horizontal direction weight
wishDirectionWeightY0.5Vertical direction weight
FieldDefaultDescription
maxSpeedMultiplier1000.0Maximum speed multiplier cap
minSpeedMultiplier0.1Minimum speed multiplier cap

For physics properties (mass, drag, gravity), use the separate PhysicsValues component:

PhysicsValues physics = store.getComponent(ref, PhysicsValues.getComponentType());
// modify physics
physics.scale(2.0f); // double all values
// or replace entirely
physics.replaceValues(new PhysicsValues(2.0, 0.8, false));
// reset to defaults
physics.resetToDefault();

Movement configurations can be defined as JSON assets and applied via MovementConfig:

// get preset from asset store
MovementConfig config = MovementConfig.getAssetMap().getAsset("my_movement_preset");
if (config != null) {
MovementManager movement = store.getComponent(ref, MovementManager.getComponentType());
Player player = store.getComponent(ref, Player.getComponentType());
PhysicsValues physics = store.getComponent(ref, PhysicsValues.getComponentType());
// apply preset as new defaults
movement.setDefaultSettings(config.toPacket(), physics, player.getGameMode());
movement.applyDefaultSettings();
movement.update(player.getPlayerRef().getPacketHandler());
}

The default preset ID is "BuiltinDefault". The active preset can be set per-world via GameplayConfig - Player.

MovementConfig has additional fields that affect fall damage but aren’t synced to clients. Fall damage is applied through the damage pipeline with DamageCause.FALL.

FieldDefaultDescription
fallDamagePartialMitigationPercent33.0Percent of fall damage mitigated by rolling
maxFallSpeedRollFullMitigation25.0Max fall speed for full roll mitigation

These are only configurable via JSON presets, not at runtime via MovementSettings.