Quark registers NeoForge capabilities that allow other mods to provide custom behavior through the standard NeoForge capability system. Currently, the primary exposed capability isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/VazkiiMods/Quark/llms.txt
Use this file to discover all available pages before exploring further.
QuarkCapabilities.CUSTOM_SORTING_CAPABILITY, which lets items provide custom inventory sorting logic.
QuarkCapabilities.CUSTOM_SORTING_CAPABILITY
ItemCapability<ICustomSorting, Void> registered under the resource location quark:custom_sorting. Quark’s inventory sorting system queries this capability on every item in the inventory to determine custom sort order and grouping.
When to Use the Capability vs. the Interface
You have two options for providingICustomSorting:
| Approach | When to use |
|---|---|
Implement ICustomSorting directly on your Item class | Your item always has the same sorting behavior regardless of NBT/components |
Provide it via CUSTOM_SORTING_CAPABILITY | You need per-stack sorting logic, or you can’t modify the Item class (e.g. patching a third-party item) |
Providing the Capability from Your Item
Register a capability provider in your mod’s initialization usingRegisterCapabilitiesEvent:
(stack, unused) -> ... receives the ItemStack and a null context (since this is a Void-context capability), and must return an ICustomSorting instance.
Example ICustomSorting Implementation
Items with the same
getSortingCategory() are grouped together during sorting and compared using getItemComparator(). Make your category unique by prefixing it with your mod ID.Querying the Capability
Quark queries the capability automatically during inventory sorting — you do not need to call it yourself. However, if you want to read another mod’s sorting information, you can query it:ISortingLockedSlots
If you have a custom Menu and want to prevent Quark from sorting certain slot indices, implementISortingLockedSlots on your Menu class (which also extends IQuarkButtonAllowed to show the Q buttons):