Skip to content

spool / PlayerMotion

Interface: PlayerMotion

Defined in: plugins/player_motion/index.ts:60

Properties

launchGlobalXyz

readonly launchGlobalXyz: FunctionRef

Defined in: plugins/player_motion/index.ts:105

api/launch_global_xyz - the raw function, to ctx.call yourself after setting launchInput.


launchInput

readonly launchInput: object

Defined in: plugins/player_motion/index.ts:111

The $x/$y/$z player_motion.api.launch input scores, as typed Scores. These are fixed-point: 10000 == 1.0 block/tick. Prefer launchLocal / launchGlobal, which take plain block/tick floats and convert for you.

x

readonly x: Score

y

readonly y: Score

z

readonly z: Score


launchLocalXyz

readonly launchLocalXyz: FunctionRef

Defined in: plugins/player_motion/index.ts:103

api/launch_local_xyz - the raw function, to ctx.call yourself after setting launchInput.

Methods

applyGlobal()

applyGlobal(ctx, velocity?): void

Defined in: plugins/player_motion/index.ts:99

Like launchGlobal, but a sustained per-tick impulse along world axes - the natural fit for swing/grapple physics, where each tick you recompute a world-space velocity (e.g. toward an anchor) and re-apply it. See applyLocal for the swap-free trigger model, the standstill caveat, and the no-velocity (runtime launchInput) form.

Note: a velocity past the +/-12398 large-vector limit return fails before the sustain flag is cleared, so it can leak into the next launch - a non-issue for per-tick velocities (a few blocks/tick), which is the only place this is used.

Parameters

ctx

FunctionContext

velocity?

GlobalVelocity

Returns

void


applyLocal()

applyLocal(ctx, velocity?): void

Defined in: plugins/player_motion/index.ts:87

Like launchLocal, but a sustained per-tick impulse: it skips the gamemode-swap trigger and relies on the player already moving to fire the enchantment that tick. Call it every tick (execute as @a[tag=…] at @s run …) to drive continuous motion - a thrust, a grapple, the arc of a swing. The very first kick from a standstill still needs launchLocal (which forces the trigger); use this to maintain motion once underway.

Omit velocity to sustain whatever is already in launchInput - the way to drive a runtime-computed vector (set the input scores yourself, then call this with no velocity).

Parameters

ctx

FunctionContext

velocity?

LocalVelocity

Returns

void


launchGlobal()

launchGlobal(ctx, velocity): void

Defined in: plugins/player_motion/index.ts:73

Launch the executing player by velocity along world axes (x/y/z in blocks/tick). Must run at the player. Inputs outside +/-12398 blocks/tick per axis hit the unsupported large-vector path and return fail.

Parameters

ctx

FunctionContext

velocity

GlobalVelocity

Returns

void


launchLocal()

launchLocal(ctx, velocity): void

Defined in: plugins/player_motion/index.ts:67

Launch the executing player by velocity relative to their facing (sideways/up/forward in blocks/tick). Emits the input writes + the call, so one line replaces the set-three-scores-then-call dance. Must run positioned as the player (e.g. execute as @p at @s run ...).

Parameters

ctx

FunctionContext

velocity

LocalVelocity

Returns

void

Released under the MIT License · Credits