Add support for Quilt Loader and QSL/QFAPI #988
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Might not be ready for merge
The goal of this PR is to allow players to use Quilt Loader + QSL alongside Optifabric without causing any additional issues compared to using Fabric Loader + Fabric API.
closes #751 and #899
Note: I will be calling Quilt Standard Libraries/Quilted Fabric API the same since, although they are different repos, there exists a single mod implementation.
I tested the following versions with Quilt Loader 0.17.11 and 0.18.3 and I haven't encountered any issues:
The versions in italics seem to start extremely slowly when using Quilt Loader 0.17.* or 0.16.1. I have not tested all of the loader versions, however it seems the startup is painfully slow on anything <0.18.
QSL exists only for versions >=1.18.2
Overcoming issues
Getting the game to start
The main problem with running Optifabric on Quilt Loader was its reliance on deprecated internal Fabric Loader APIs. By checking if Quilt is present and, if so, not using those internal APIs, this issue can be easily circumvented, allowing the game to start normally.
Getting Quilt Standard Libraries to work
QSL makes use mostly of Fabric API mixins, so there aren't many issues to fix (in theory at least).
GameRendererMixin
requires its ownInterceptingMixin
due to slightly differentonBeforeRenderScreen
andonAfterRenderScreen
callback injectors.ItemStack.isOf(Items.CROSSBOW)
toinstanceof CrossbowItem
inside therenderFirstPersonItem
method.HeldItemRendererFix
replaces the Optifine method with the vanilla one and re-adds Optifine's checkShaders.isSkipRenderHand
at the head of the method. As far as I noticed, Optifine doesn't add any other behavioural changes.HeldItemRendererFix
will run whether or not QSL is present at runtime.fabric-x
the version ofquilted_fabric_x
will be returned instead. As such,OptifabricSetup
will explicitly check if the quilted version of the mod is present, without checking the version, because even the lowest QSL mod version is based on a Fabric API version whose modules satisfy every version check inOptifabricSetup