Skip to content

InteractionProxy.Break ​

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

Manages the shared block-breaking override and its pending callbacks through client hooks; it is not a per-instance controller or confirmation of server-side breaking. Scripts normally use the player's interaction manager:

js
const interactions = Player.getInteractionManager();  
if (interactions !== null) {
 if (interactions.hasBreakBlockOverride()) {
   interactions.cancelBreakBlock();  
 }
}

The query can itself end an invalid override and invoke callbacks. Cancelling reports CANCELLED to pending callbacks synchronously on the caller's thread.

Nested type declared in InteractionProxy.

Nested types ​

Constructors ​

new InteractionProxy.Break ​

new InteractionProxy.Break()#

Methods ​

addCallback ​

static addCallback(Consumer<InteractionProxy.Break.BreakBlockResult> callback, boolean breaking): void#
Queues a non-null outcome callback and optionally enables the override. Enabling resets the tracked target; it does not start a block-break action. A false breaking value leaves the current override unchanged. Callbacks run on the dispatching caller's thread while the callback monitor is held. Each callback's Exception is printed and iteration continues; the queue is cleared after normal iteration. Reentrant queue mutation or an Error can prevent completion.

Parameters:

  • callback: consumer for a later outcome, or null to add none
  • breaking: whether to enable the override

isBreaking ​

static isBreaking(): boolean#
Validates the override against the current level, crosshair block, and tracked position; failed checks can disable it and dispatch callbacks on this caller's thread. This does not query native destruction state or confirm server acceptance. The first valid block target becomes the tracked position; a changed position, a missing block target or air can end the override.
Returns: whether the override remains active after these checks

onBreakBlock ​

static onBreakBlock(BlockPos pos, boolean ret): void#
Reports the client block-destruction call result to the active override. A true result while active disables the override and reports SUCCESS with the position to callbacks on this caller's thread. Otherwise this does nothing; SUCCESS does not confirm server acceptance.

Parameters:

  • pos: position reported as broken
  • ret: result of the client destruction call; false leaves the override unchanged

setOverride ​

static setOverride(boolean value): void#
Enables or disables the override, resetting its tracked target either way. Disabling may stop client-side breaking and dispatch pending callbacks with a null reason and position, even if already disabled. Runs directly on the caller; enabling does not start a block-break action.

Parameters:

  • value: whether to enable the override
static setOverride(boolean value, String reason): void#
Enables or disables the override, resetting its tracked target either way. The reason is sent to callbacks only on disable, with a null position, even if already disabled. Disabling calls stopDestroyBlock() only when a game mode exists and the attack key is not down. Runs directly on the caller; enabling does not start a block-break action.

Parameters:

  • value: whether to enable the override
  • reason: reported reason when disabling, or null; ignored when enabling