Sort dependencies first in modpacks #4252
Merged
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.
Motivation
#3499 sorted the relationships in modpacks alphanumerically by identifier (rather than randomly). There have been some problems with this; since the ordering of a changeset matters, sorting alphanumerically means that dependencies might end up later in the changeset than their depending mods, so for instance there might be cases where a user is prompted to choose a mod and is allowed to pick one that will conflict with a dependency of something later in the changeset.
Changes
Now we use a relationship resolver to sort dependencies before depending mods in modpacks. This way when a new modpack is exported, the ordering will better reflect how the mods should be installed.
Ideally we would also give the user some options for manually reordering mods, but I discovered that WinForms's
ListView
control cannot do that when item groups are in use. It either puts movedListViewItem
s in the wrong place or omits them completely, and if we try rebuilding the entire list from scratch, there is no way to restore the scroll position so you can see the mod you just moved. Perhaps something to come back to in the future if we feel like reimplementing the modpack editor with a different underlying control.Side fixes
To test this, I tried installing the community lifeboat modpack and found that the scrollbars from #4249 flickered quite a bit. Some calls to
SuspendLayout
andResumeLayout
are added to improve this.