Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.20.1] Prevent mixins from crashing the game when there are missing mods #85

Merged
merged 3 commits into from
Feb 4, 2024

Conversation

embeddedt
Copy link
Member

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 or IllegalAccessError. 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.

@embeddedt embeddedt changed the title Prevent mixins from crashing the game when there are missing mods [1.20.1] Prevent mixins from crashing the game when there are missing mods Feb 4, 2024
@embeddedt embeddedt requested a review from Technici4n February 4, 2024 16:53
@Technici4n Technici4n merged commit 3adccc1 into neoforged:1.20.1 Feb 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants