--- title: "For mod developers - Sorted wiki" description: "What other mods can do with Sorted, and how to call it without making it a requirement." url: https://voxelsprout.com/sorted/wiki/api --- [Sorted](https://voxelsprout.com/sorted) [Wiki](https://voxelsprout.com/sorted/wiki)For mod developers # For mod developers What other mods can do with Sorted, and how to call it without making it a requirement. Sorted has two public APIs, both in the package `com.sorted.api` and both on the client. The examples use the Mojang names of Minecraft 26.x. | API | What it is for | Since | | ----------------------------------------- | ------------------------------------------------------------------------------------------ | ------ | | [SortedStorage](https://voxelsprout.com/sorted/wiki/storage-api) | Let Sorted treat your containers as storage: its buttons, sorting, Quick Stack and search. | 0.1.22 | | [SortedLookup](https://voxelsprout.com/sorted/wiki/lookup-api) | Ask what Sorted has seen in the player's containers: counts, positions, highlights. | 0.1.13 | ## Keep Sorted optional Sorted is client-side, and most players of your mod will not have it. Two ways to call it without making it a requirement: * Check `FabricLoader.getInstance().isModLoaded("sorted")`, and keep the calls in a class of their own, so Sorted's classes only load when it is there. * Or call it by reflection. The storage calls and the plain-typed lookup calls take only Java types (`String`, `long`, `java.util.function`), so there is nothing to compile against. See the [example](https://voxelsprout.com/sorted/wiki/storage-api#without-a-compile-dependency). Client initializer ```java public final class MyModClient implements ClientModInitializer { @Override public void onInitializeClient() { if (FabricLoader.getInstance().isModLoaded("sorted")) { SortedCompat.init(); } } } // A class of its own: Sorted's classes only load when Sorted is there. final class SortedCompat { static void init() { SortedStorage.register("mymod:iron_chest"); } } ``` ## Compiling against it Sorted is on [Modrinth](https://modrinth.com/mod/sorted), so the Modrinth Maven works. Several files share a version number, one per range of Minecraft versions, so use the version id of the file for yours. It is on the file's page on Modrinth. `build.gradle` ```gradle repositories { maven { url = "https://api.modrinth.com/maven" } } dependencies { // The version id of the Sorted file for your Minecraft version, from its Modrinth page. // 26.x: compileOnly. 1.21.x: modCompileOnly. modCompileOnly "maven.modrinth:sorted:" } ``` Sorted is a Fabric mod. It is client-side only, so call it from client code. ## Questions Something the API should do, or something that does not work: ask on [Discord](https://discord.gg/CvdkGbEW4y). [Previous Bug reports](https://voxelsprout.com/sorted/wiki/bug-reports) [Next Storage API](https://voxelsprout.com/sorted/wiki/storage-api) Something missing or wrong on this page? Say so on [Discord](https://discord.gg/CvdkGbEW4y).