|
| 1 | +Sort It Out! has a resource-pack driven system for modifying where sort buttons are displayed for different screens. |
| 2 | + |
| 3 | +By default, Sort It Out! provides definitions for vanilla containers, and some modded containers. If no definition is present for a screen, the mod attempts to add a default position button for sorting the player inventory. |
| 4 | + |
| 5 | +## Adding a Custom Definition |
| 6 | + |
| 7 | +> If you are adding a definition, please consider contributing it to Sort It Out! directly or suggesting it on the [GitHub page](https://github.com/JamCoreModding/sort-it-out). This guide assumes a basic familiarity with creating resource packs, and with using Linkie. If you are unfamiliar with either, please ask on the Discord or the GitHub page. |
| 8 | +
|
| 9 | +Sort button defitions are split into two parts: the type predicate, which defines what screen the definition applies to, and the button definitions, which defines where sort buttons should appear and what inventories they should sort. |
| 10 | + |
| 11 | +First, create a resource (not data) pack and add the file `<your resource pack namespace>/sort_buttons/<arbritrary name for your sort button definition>.json`. |
| 12 | + |
| 13 | +Open Minecraft and run `/sortitoutc toggle_slot_index_debug_renderer`, then open the container/screen you want to add sort buttons to. This shows the index of each slot, along with a class name for the screen (starting `net.minecraft.`) and a resource location (like `minecraft:inventory`, or `null`). If the resource location is `null`, the type predicate will need to refer to the screen by class. To do this, you need to know the fully-qualified mojmap and intermediary names for the screen. Use [Linkie](https://linkie.shedaniel.me) for this (this tutorial is not a Linkie guide, however). |
| 14 | + |
| 15 | +The JSON file should then be filled in like so: |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + // If the resource location was not null, use the following: |
| 20 | + "type": "<resource location>", |
| 21 | + // Otherwise, use this `type`: |
| 22 | + "type": { |
| 23 | + "mojmap": "<mojmap class name>", |
| 24 | + "intermediary": "<intermediary class name>" |
| 25 | + }, |
| 26 | + // Then, add your sort button definitions |
| 27 | + "sortButtons": [ |
| 28 | + { |
| 29 | + "xOffset": 12, // x offset from the left-hand side of the screen |
| 30 | + "yOffset": 10, // y offset from the top of the screen (positive down) |
| 31 | + "slotStartIndex": 0 // an index of any slot in the inventory section that this button should sort. |
| 32 | + }, |
| 33 | + // repeat as many times as you like to add more sort buttons |
| 34 | + ] |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +To remove the default sort buttons for a screen, just set `sortButtons` to an empty array (`[]`). |
| 39 | + |
0 commit comments