Fix selection and scroll amount not restoring in mod list#1041
Conversation
|
Still need to test opening ModMenu and immediately clicking the Config button (reversion). |
|
OK this tests out good as far as I can tell. Selections are retained where they should be and I haven't found a way to get a Config button when I shouldn't. Judging from the summary, this needs backported through 1.21.9. |
|
Well i found a way to make selected null if you make all mods hidden through the config but i'm not sure if thats relevant for this PR since I can do that before the reposition check and the "ensure valid entry is selected logic" was added, as far back as 1.21.1, and it just crashes instantly in versions prior. |
OK, I think that's a separate issue. It would be cool to fix but I'm not sure what I'd do. Maybe display some dummy entry instead ("mods goes here my mans")? Or just forcibly exempt ModMenu itself from being excluded from the visible mods... |
Fixes #1020
The commit 5e16dfa broke the fix on #837 since selecting an entry also scrolls to that entry on AbstractSelectionList since Minecraft 1.21.9
Passing true to reposition when reloading filters on ModListWidget#finalizeInit already ensures that either the last selected or the first entry will be selected, and finalizeInit will restore the scroll amount anyway.