Input API

Ask Sorted to leave Alt on items to your mod.

In an inventory, Sorted uses Alt+click on an item for the The keep list, Alt+Shift+click for the The blacklist and Alt+scroll for the keep count, and shows its marks while Alt is held. If your mod uses Alt on items too, ask Sorted to step aside, and the click goes to your mod alone. From Sorted 0.1.42.

Java
// From your client initializer, or whenever your own Alt gesture is switched on.
SortedInput.yieldAlt("mymod");

// Your gesture is off again: Sorted's come back once no mod asks.
SortedInput.releaseAlt("mymod");

Sorted's own buttons are not part of this: Alt+click on Sort is still a compact sort.

The player decides #

Alt on items in Sorted's settings has the last word. Automatic, the default, steps aside while any mod asks. On keeps Sorted's gestures whatever mods ask, Off turns them off without one. The setting names the mods that asked.

Without a compile dependency #

Java
try {
    Class.forName("com.sorted.api.SortedInput").getMethod("yieldAlt", String.class).invoke(null, "mymod");
} catch (ReflectiveOperationException e) {
    // Sorted is not installed, or older than 0.1.42. Nothing to do.
}

Reference #

SortedInputWhat it does
yieldAlt(String owner)Sorted's Alt gestures on items step aside for you until releaseAlt.
releaseAlt(String owner)They come back once no mod asks.
altOwners()The mods that asked, in the order they asked.
altGesturesOn()Whether they are on now, the setting and the requests taken together. Cheap, fine every frame.
isAvailable()Sorted is running, in a world, and not off on this server.

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