Actions API

List and run BuildPrint's switches and screens, from a hotkey wheel or a menu of your own.

For a mod with its own wheel or menu of actions. From BuildPrint 0.1.27.

Java
for (String id : BuildprintActions.ids()) {
    String name = BuildprintActions.label(id);   // "Easy place", in the player's language
    Boolean on = BuildprintActions.isOn(id);     // null when it isn't a switch
}
BuildprintActions.run("buildprint:printer");     // as the printer key does

The ids #

Each is buildprint:<name>: menu, assist (easy place), destroy (easy break), printer, editor, editor_card, show_filter, slice_up, slice_down, hide_all, hide_here, focus_held (only the block in hand on show, since 0.1.31), hud, settings and sessions.

The switches are assist, destroy, printer, editor, editor_card, hide_all and hide_here (on means hidden). A server rule that refuses one says so to the player, and run still returns true.

Reference #

BuildprintActionsWhat it does
isAvailable()In a world. When false, ids() is empty, isOn null and run false.
ids()A List<String> of the action ids, in wheel order.
label(String id)A short name in the player's language, null for an unknown id. Works outside a world too.
isOn(String id)Whether a switch is on, as a Boolean. Null for one that is not a switch or an unknown id. Cheap enough for every frame.
run(String id)Runs it as its key does, saying so above the hotbar as the key does. False for an unknown id or when it failed (logged).

Something missing or wrong on this page? Say so on Discord.