Skip to content

MovementQueue ​

com.jsmacrosce.jsmacros.client.movement.MovementQueue

Shared queue and prediction overlay used to play back queued player inputs.
Scripts normally use Player.addInput, Player.addInputs,
Player.clearInputs, and Player.setDrawPredictions; this support class is not a per-player queue.

js
if (Player.getPlayer() !== null) {
 Player.setDrawPredictions(true);  
 Player.addInput(Player.getCurrentPlayerInput());  
}

Constructors ​

new MovementQueue ​

new MovementQueue()#

Fields ​

predPoints ​

static predPoints: Draw3D#
Current prediction and error-point overlay; clear() replaces this reference.

Methods ​

append ​

static append(PlayerInput input, LocalPlayer newPlayer): void#
Copies an input into the queue and schedules its predictions for recalculation. Stores the supplied player without resetting the queue position or replaying consumed inputs. This method is not synchronized with the class monitor used by tick, clear, and setDrawPredictions; callers must coordinate concurrent access. The input must not be null.

Parameters:

  • input: input to copy into the queue
  • newPlayer: local player used for subsequent prediction updates

clear ​

static clear(): void#
Clears queued inputs and predictions, resets the queue position, and replaces the overlay. The drawing-enabled state is preserved, and the stored player and prediction-recalculation flag are not reset. The old overlay is removed from HUD registration, not emptied; its replacement is a new empty overlay, registered immediately if prediction drawing remains enabled.

setDrawPredictions ​

static setDrawPredictions(boolean val): void#
Enables or disables registration of the current prediction overlay for drawing. The overlay registration changes only when the enabled state changes; this does not clear points or control whether predictions are generated.

Parameters:

  • val: whether prediction drawing should be enabled

tick ​

static tick(LocalPlayer newPlayer): PlayerInput#
Updates predictions for the next queued input and returns that stored input. This method does not apply the input to the player. Prediction markers may be appended even while the overlay is unregistered for drawing. When the queue is exhausted, returns null without updating the player reference or prediction state. The queue position advances only after prediction work completes; consumed entries remain queued until clear().

Parameters:

  • newPlayer: non-null local player used for prediction updates when input remains; ignored when exhausted
Returns: the next stored input, or null when the queue is exhausted