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.
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 #
| Id | What it does |
|---|---|
sorted:search | Opens the item search. |
sorted:keep_list | Opens the keep list. |
sorted:sort_inventory | Sorts the inventory, with or without a screen open. |
sorted:quick_stack_nearby | Puts items into nearby containers that already hold them. |
sorted:smart_empty_nearby | Puts everything into the best-fitting nearby containers. |
sorted:quick_fill_nearby | Tops up the inventory's stacks from nearby containers. |
sorted:clear_highlight | Takes away the search highlight. |
sorted:auto_sort_inventory | A switch: sorting the inventory on its own. |
sorted:auto_sort_containers | A switch: sorting chests as they open. |
sorted:settings | Opens Sorted's settings. |
Reference #
| SortedActions | What 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.