Skip to content

InteractionProxy.Interact ​

com.jsmacrosce.jsmacros.client.api.classes.InteractionProxy.Interact

Manages the shared held-use override maintained by client hooks; it is neither a physical-key query nor a per-player interaction controller. Scripts normally access it through the player interaction manager:

js
const interactions = Player.getInteractionManager();  
if (interactions !== null) {
  if (interactions.hasInteractOverride()) {
    interactions.holdInteract(false);  
  }
}

Disabling requests a later release check; it does not guarantee a server-side cancellation.

Nested type declared in InteractionProxy.

Constructors ​

new InteractionProxy.Interact ​

new InteractionProxy.Interact()#

Methods ​

ensureInteracting ​

static ensureInteracting(int cooldown): void#
Maintains held-use state from client hooks. With no player it returns without changing state. A down use key clears the override flag without requesting a release check. When the override remains enabled, cooldown is exactly zero and the player is not using an item, this calls mc.startUseItem(). Otherwise, a pending release check calls mc.gameMode.releaseUsingItem(mc.player) only when the game mode exists, the player is using an item and the use key is not down; the pending check is then cleared even if those conditions are unmet. A call failure can prevent that final clearing.

Parameters:

  • cooldown: current use-item delay; a new use attempt requires exactly zero

isInteracting ​

static isInteracting(): boolean#
Reports whether the held-use override flag is enabled; this does not query key or item use.
Returns: whether the held-use override is currently enabled

setOverride ​

static setOverride(boolean value): void#
Sets the held-use override directly on the caller. Enabling clears a pending release check and calls mc.startUseItem() on every call. Disabling an active override records a deferred release check; it does not release the item here. Prefer the interaction-manager helper for normal script use.

Parameters:

  • value: whether to enable the override; false requests a later release check when disabling an active override