Actions API

Run Sorted's actions by id, for a shortcut wheel, a radial menu or buttons of your own.

SortedActions lists what Sorted can do, by id, with a name in the player's language, and runs it. Sort the inventory, Quick Stack to nearby containers, open the search. From Sorted 0.1.31.

Java
if (SortedActions.isAvailable()) {
    for (String id : SortedActions.ids()) {
        String name = SortedActions.label(id);   // in the player's language
        Boolean on = SortedActions.isOn(id);     // true/false for a switch, null otherwise
    }
    SortedActions.run("sorted:quick_stack_nearby");
}

run does it once, and returns false when the id is unknown, the server does not allow it, or there is nothing to do. isOn is cheap, fine every frame.

The actions #

IdWhat it does
sorted:searchOpens the item search.
sorted:keep_listOpens the keep list.
sorted:sort_inventorySorts the inventory, with or without a screen open.
sorted:quick_stack_nearbyPuts items into nearby containers that already hold them.
sorted:smart_empty_nearbyPuts everything into the best-fitting nearby containers.
sorted:quick_fill_nearbyTops up the inventory's stacks from nearby containers.
sorted:clear_highlightTakes away the search highlight.
sorted:auto_sort_inventoryA switch: sorting the inventory on its own.
sorted:auto_sort_containersA switch: sorting chests as they open.
sorted:settingsOpens Sorted's settings.

Reference #

SortedActionsWhat it does
isAvailable()Sorted is running, in a world, and not off on this server.
ids()Every action id, in menu order.
labelKey(String id)The translation key of its name, or null for an unknown id.
label(String id)Its name in the player's language, or null for an unknown id.
isOn(String id)True or false for a switch, null for anything else.
run(String id)Runs it once. False when unknown, not allowed by the server, or nothing to do.

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