Blockbench Reference Docs
    Preparing search index...
    SharedActions: {
        actions: Record<string, SharedActionHandler[]>;
        add(action_id: string, handler: SharedActionHandler): Deletable;
        condition(action_id: string): boolean;
        find(action_id: string, event?: Event, context?: any): SharedActionHandler;
        run(action_id: string, event?: Event, context?: any): boolean;
        runSpecific(
            action_id: string,
            subject: string,
            event?: Event,
            context?: any,
            force?: boolean,
        ): boolean;
    }

    Global Shared Actions namespace to access any functionality related to Shared Actions

    Type Declaration

    • actions: Record<string, SharedActionHandler[]>
    • add: function
      • Add a method to handle a specific use case of a shared action

        Parameters

        Returns Deletable

    • condition: function
      • Check if there is an active and available handler in the current situation for a shared action

        Parameters

        • action_id: string

        Returns boolean

    • find: function
      • Find the active handler in the current situation for a shared action

        Parameters

        • action_id: string
        • Optionalevent: Event
        • Optionalcontext: any

        Returns SharedActionHandler

    • run: function
      • Run the active handler for a specific subject manually

        Parameters

        • action_id: string

          Action ID

        • Optionalevent: Event

          Event that triggered the interaction

        • Optionalcontext: any

          Optional context variable

        Returns boolean

    • runSpecific: function
      • Run a specific handler manually

        Parameters

        • action_id: string

          Action ID

        • subject: string

          Subject to run on

        • Optionalevent: Event

          Event that triggered the interaction

        • Optionalcontext: any

          Optional context variable

        • Optionalforce: boolean

          Force the specified handler to run and ignore its condition

        Returns boolean