[1.20.1] Prevent mixins from crashing the game when there are missing mods #85
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.
The issue was fixed in newer FML versions by adding the new
[[mixin]]
syntax; this is a workaround for 1.20.1. I have copied the description from my original PR to MCF below.In FML versions post-modularization, mixins are still loaded even if there is a missing dependency. Unfortunately, said mixins can attempt to load missing classes (causing a crash), or attempt to access a field that was transformed by an AT, which will not happen when there are loading errors, also causing a crash.
This PR solves the issue by not allowing mod resources to enter the classpath at all, preventing the mixin configs from being loaded which restores the 1.16 behavior. Now, the loading error screen will be properly shown instead of the game crashing with some random
ClassNotFoundException
orIllegalAccessError
. This issue was particularly aggravating for support Discords as users report a "crash" when it's really just that they haven't installed a mod.I have made the PR against 1.20.1, as that's the version I was using for testing. The test case I used in production is to install the mod Supplementaries, version 1.20-2.7.14, without installing its dependency, Moonlight Lib. Without this PR, the game crashes with
ClassMetadataNotFoundException
. If I replace the fmlloader JAR with one from this PR, the game reaches the loading error screen.You'll notice that this change is disabled in dev. This is to prevent dev environments using
--mixin.config
from crashing if there is a dependency error due to the mixin file no longer being found. The issue is only really a problem for production environments, where users do not know to read their log and find the missing dependency error.