(For an almost full technical report, it’s on my GitHub discussion https://github.com/orgs/FabricMC/discussions/5200. Here I’ll go through my thought process)
Took 9h, which was honestly way too long, I was trying to figure out how I can redirect the resource screen button in the options screen menu to open my screen instead of what it usually opens.
My first method was to try and redirect the output screen, which is what in the end I went with and managed to get it.
The second method I was thinking of was to do what Mod Menu did, and remove the Resource Pack button and replace it with my own button, but I hardly explored this option (although it could honestly save me a bunch of time)
The third and final method I thought of was to completely replace the screen that Resource Packs button opens, but I did not do this for a few reasons.
The first method that I did, and the one that eventually worked, was to use Mixin Extras’ Expressions syntax to match the specific line of code I needed to change.
Using iy, I matched the screen supplier (the one that decides which screen to open) and changed it to my own screen (with some help for the syntax and for telling me Expressions exist, by the creator of Mixin Extras: LamaLad7)
I spent way too long on this
took me 30 min to realise 2 brackets caused me some errors, and even longer to get the Annotation right, which was just there in the wiki and i still copied it wrong 💀
IntelliJ’s MCDev plugin was a lifesaver for this, probably wouldn’t have got it without it.
I don’t know why I did not consider the second method (replacing the resource pack button) ngl.
probably would have saved me so much time.
As for the third method, I did not want to do it as,
- I did not even think it was even possible to completely change pack selection screen
- I could (hopefully) easily make it so that if there is a critical error with my mod’s screen, i can fallback to the old pack selection screen