packwiz / packwiz-installer

An installer for packwiz modpacks, with automatic auto-updating and optional mods! Works well with MultiMC and on servers.
https://packwiz.infra.link/
MIT License
46 stars 21 forks source link

Initial MultiMC Forge and MC version support #31

Closed geferon closed 2 years ago

geferon commented 2 years ago

I've decided to add MultiMC support, where the packwiz installer will automatically update the MC and Forge versions according to the packs metadata. Right now this only supports Forge, but I will see if I can add support for Fabric in the future. I've tested this feature locally and it works perfectly fine, if Forge's version or MC's version differs, the installer will automatically update the JSON file of the pack with the new versions and MultiMC will download and install them accordingly, as Packwiz installer gets run in the pre-launch phase, and it doesn't get overwriten or anything by it, so it runs just fine. If there's something about the code you don't like or that you'd like me to modify please tell, and I will try to change it to your liking.

comp500 commented 2 years ago

Could you add a dialog box asking the user if they want to update? Should have 3 buttons, allowing the user to cancel the launch, continue without changing game/loader version, and automatically update the version.

@EcoBuilder13 you mentioned you were going to implement this, did you get anywhere with that?

geferon commented 2 years ago

Sure thing! I'll get that started and update the PR!

geferon commented 2 years ago

That should do, I think? I added a method to IUserInterface called showCustomDialog Basically taking three parameters which would be the usual for a JOptionPane.showOptionDialog method. I dunno what your convention on the regard is, or if you'd prefer using a method like... "showUpdateConfirmationDialog" or such instead with an Enum as a return?

geferon commented 2 years ago

Oh I also added support for Fabric while I was at it

comp500 commented 2 years ago

"showUpdateConfirmationDialog" or such instead with an Enum as a return?

I'd prefer this, particularly since it allows the CLI to implement it in future (or use flags/etc)

geferon commented 2 years ago

Alrighty, I'll refactor it when I have a chance at it tomorrow

geferon commented 2 years ago

Okay that should do it

EcoBuilder13 commented 2 years ago

@comp500, I have not implemented my version due to lack of time. If you are happy with this implementation feel free to use it. Somethings that may want to be taken into account with this implementation is lack of Quilt support and lack of loader switching support (ex: converting a Fabric modpack to Quilt). A small edge case that may need to be handled is the LWGJL and the Intermediary Mappings version. If MultiMC doesn't handle upgrades automatically packwiz will need to take care of it. To my knowledge Intermediary Mappings updates whenever you update the game version and has the same value of the game version. LWGJL is a little bit harder to take care of and has more edge cases. It gets automatically updated when updating from 1.18.x to 1.19.x in the UI but otherwise I'm not sure how it handles it. If we even need to worry about it we need to take into consideration that some users may have MultiMC configured to use a system installation of LWJGL and if we add LWJGL to the pack.toml it may cause confusion with versioning. Meaning we would need to maintain the optimum version internally so it is auto handled or have a tool people can use to find out the best version.

geferon commented 2 years ago

Doesn't MultiMC automatically handle mappings on launch? As far as I've seen after testing with this, MultiMC does re-dl the mappings on launch and update the json file accordingly. Now, for LWJGL I have no idea.

comp500 commented 2 years ago

lack of Quilt support and lack of loader switching support (ex: converting a Fabric modpack to Quilt).

Agreed, this would definitely be appreciated in the PR.

LWGJL is a little bit harder to take care of and has more edge cases. It gets automatically updated when updating from 1.18.x to 1.19.x in the UI but otherwise I'm not sure how it handles it.

I did some testing; it looks like MultiMC will automatically handle this for you, even if you change the game version by editing mmc-pack.json it will get changed to the correct version.

To my knowledge Intermediary Mappings updates whenever you update the game version and has the same value of the game version.

If you change it from mmc-pack.json it looks like it complains about the versions not matching, rather than automatically changing it. If you remove the net.fabricmc.intermediary component though, it will retrieve the correct version when using Quilt/Fabric - so I think the fix would be to just remove the net.fabricmc.intermediary component whenever changing the Minecraft version.

geferon commented 2 years ago

Just pushed changes for most of the review, I just need your input on two of them.

comp500 commented 2 years ago

Did you comment replying to my comments? I don't see any replies, not sure what input you need :P

geferon commented 2 years ago

On the review there are two pending comments yeah.

comp500 commented 2 years ago

You might need to complete the review for me to see them?

geferon commented 2 years ago

You should be able to open the review and see it, it only allows me to cancel the review, you're the only one allowed to approve the review or request more changes.

comp500 commented 2 years ago
I only see these: ![image](https://user-images.githubusercontent.com/1138417/175073022-765df77f-7176-4d17-9281-c94d093bc250.png)
You might have to click the "submit review" button anyway? ![image](https://user-images.githubusercontent.com/1138417/175073152-f517bc61-925d-49d9-8361-d38b529941fa.png)
geferon commented 2 years ago

I believe you were right but at the same time if you click on those two unresolved conversations you should be able to see my comment on them and being able to comment on it. Anyways, I submitted it for review.

comp500 commented 2 years ago

I see them now - they weren't there before! The UI is a bit strange, I think if you add comments from the changes tab it will require "submitting" the review but it's not super clear when you need to do that.

geferon commented 2 years ago

Oh huh, that's unintuitive, I pushed all changes

geferon commented 2 years ago

Any updates on this?