onInteract method
In your tick function, you can use .onInteract()
to detect the interaction.
This uses the execute on command, and removes the interaction nbt data if present:
Implementation
Execute onInteract({Entity? select, required List<Widget> run}) =>
Execute(as: select ?? this.select(), children: [
Execute.on(Relation.target, children: run),
Data.remove(Entity.Self(), path: "interaction"),
]).If(Condition.data(Data.get(Entity.Self(), path: "interaction")));