QSL and QFAPI Overview
This article explains the different standard libraries you might encounter when modding with Quilt.
What is an API?
An API (Application Programming Interface) provides an interface for programs to interact with other programs. In the context of Minecraft modding, APIs tend to provide tools for better compatibility between mods or provide other useful extensions. For example, many of the bigger mods you might know of have an API which allows other mods to improve compatibility with them.
In addition to that kind of API, there are libraries. Libraries themselves do not add any content to the game, and instead implement an API to make certain features simpler to implement for other developers. Fabric API and Quilt Standard Libraries are examples of official libraries published by the specific loader.
It is important to note that an API only defines the means to interact with a specific program and the corresponding behavior, not its actual implementation. The implementations may change at any time and thus shouldn’t be used. Implementations tend to contain
impl in the package or class name, while APIs sometimes are in an
Fabric API (FAPI for short) is Fabric’s API and provides some useful APIs that Quilt Standard Libraries does not provide, such as a majority of rendering APIs, the item group API and a key binds API. For Quilt, Quilted Fabric API is an alternate implementation, that uses Quilt Standard Libraries where possible.
Quilt Standard Libraries
The Quilt Standard Libraries (QSL for short) provide lots of core functionality for mods, as well as many useful APIs, such as Registry Entry Attributes.
Some features QSL provides are:
- The main entrypoints for mods.
- Loading the
datadirectory of your mod through the resource loader.
- Many events such as world tick events.
- Extension classes and interfaces for many blocks, items, entities, and more.
While you can make your mod work with just mixin, QSL does a lot of the heavy lifting and makes sure that common features mods have won’t cause conflicts between them. QSL will also try to keep its API fairly stable between Minecraft versions, so that you have to do less work when updating your mod.
However, QSL’s API is not complete enough to provide all functionality that would be provided by Fabric API (Likewise, FAPI does not provide everything QSL provides), which is why you’ll find yourself using Quilted Fabric API in projects quickly.
Quilted Fabric API
Quilted Fabric API (QFAPI for short) provides Fabric API, but implements the API using QSL where possible. APIs from FAPI with a proper QSL alternative are deprecated in QFAPI, so consider using QSL APIs when some Fabric API methods are deprecated.
Quilted Fabric API has two main use cases:
- It provides a compatibility layer so that Fabric mods can be loaded on Quilt.
- And it allows using Fabric’s APIs when QSL does not yet provide relevant APIs. This is for example the case for item groups.
Because QFAPI depends on QSL and needs to know Fabric’s implementation, it will always update after Fabric API and QSL have been updated.