InteractBlock
com.jsmacrosce.jsmacros.client.api.event.impl.player.EventInteractBlock
Fires after a local block-use attempt returns, unless the result is FAIL. result is true when the interaction consumes an action; false means it was passed along without consuming one, not that it failed.
js
JsMacros.on("InteractBlock", JavaWrapper.methodToJava(function (event) {
if (event.result) {
Chat.log(`${event.offhand ? "Off hand" : "Main hand"} used on ${event.block.getId()}`);
}
}))Constructors
new EventInteractBlock
new EventInteractBlock(boolean offhand, boolean accepted, BlockDataHelper block, int side)#Stores the supplied block-interaction data and initializes the event with the client core.
Parameters:
offhand: whether the supplied hand flag identifies the off hand;falseidentifies the main handaccepted: supplied action-consumption flag, stored asresultblock: the supplied block helper referenceside: the supplied hit-face code
Fields
block
The clicked block as seen by the client, including its block entity when present.
offhand
true if the click was made with the off hand, false if it was made with the main hand.result
true when the interaction consumes an action; false when it passes without consuming one. This event is not fired for a FAIL result.side
The clicked face's numeric direction id:
0 down, 1 up, 2 north, 3 south, 4 west and 5 east.Methods
toString
Returns this event's formatted string representation. The payload has the form
eventName:{"block": helper, "result": "boolean"}; the boolean value is quoted, and the offhand and side values are omitted. This is not JSON.Returns: the event-name-prefixed representation containing the block helper and stored result