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

Add basic optifine support #240

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

pi-dev500
Copy link

This file add a complete optifine support, but you should improve it for events support. Please notify me if you get any errors. And happy christmas for everyone !

@mindstorm38
Copy link
Owner

Wow 😳 Insane work, yes there is some huge refactor to do for the events system but all this patch reimplementation is insane, great work!

@pi-dev500
Copy link
Author

Worked a bit on that today, but it's a bit hard to figure in which order to install the thing... looking in the code of forgeversion helped me.

@mindstorm38
Copy link
Owner

mindstorm38 commented Jan 1, 2025

Side note, with the upcoming Rust rewrite, would you be interested in adapting this code directly into it ? I think the first releases will not includes optifine support, if you don't want to do it I'll do it but you'll definitely be credited for that module.

PS: Happy new year :)

@pi-dev500
Copy link
Author

As I never written anything in Rust, I'll need some adaptation time, but first, I prefer do the whole algorithm in python, an then copy the code to another language. In fact, my event handling is not far from being ready, but I think that marking this python PR as draft is needed, as it is still in progress, and will probably not be merged.

@mindstorm38
Copy link
Owner

Yes doing the whole algorithm un python is the right way to go for now!

Also, would you be able to provide a list of new dependencies that would be needed for that module to work? I've tried to use no dependencies until now so maybe as a very last step in this PR we could try to reduce them, but I don't want to bother you with that now.

@pi-dev500
Copy link
Author

The only python deps were beautifulsoup4 and requests, requests is on the way to be deleted, and beautifulsoup4 is only used to list available versions, so realy no problem on that side, removing them will be easy.

@mindstorm38
Copy link
Owner

mindstorm38 commented Jan 2, 2025

Thank you for putting so much attention into this PR!

EDIT: Would you be able to also provide a backend for the portablemc search command, to list every installable version? Note that this is not necessary and the first versions to include Optifine support do not need this in the first place, but this would be a good addition in the future.

Add the possibility to download using query
Remove debug, improve install process, remove dependencies and add events.
@pi-dev500
Copy link
Author

The event system is there, and the install process is much cleaner and understandable. On top of that, I removed the two dependencies (requests and beautifulsoup4). Next to do for me: handling the new api in the CLI launcher... Search method should be simple to integrate (have a look at optifine.get_compatible_versions). Loader version are currently names like this: "preview_OptiFine_1.21.4_HD_U_J3_pre6" I should shorten them to things like "HD_U_J3_pre6"

@mindstorm38
Copy link
Owner

Perfect! Do you want a pre-review on the API code, I don't want to spam you with change requests if the code is not yet 90% ready.
Yes, you should try to shorten the loader version, without making it ambigous! This looks good like this.

@pi-dev500
Copy link
Author

Just a question, what should be the default version name for an optifine version ? Is it better to keep official optifine installation format ("<mc_ver>-Optifine_") or use "-<mc_ver>-" like in forgeversion and fabricversion ?

@mindstorm38
Copy link
Owner

mindstorm38 commented Jan 10, 2025

Just for information, the forge version specifier will be modified with the upcoming Rust rewrite. Here's the help message:

- forge::<loader-version> | forge:[<game-version>][:stable|unstable] => the 
syntax is a bit cumbersome because you can either specify the full loader version
such as '1.21.4-54.0.12' but you must leave the first parameter empty, or you 
can specify a Mojang game version with optional second parameter that specifies
if you target the latest 'stable' (default) or 'unstable' loader version.
See https://minecraftforge.net/.

Anyway, for OptiFine, I would like to use another format, like optifine:[<game-version>[:<edition>]]. For example optifine: will start the latest optifine version for the latest release, optifine:1.21.3 at the time of writing would be equivalent to optifine:1.21.3:HD_U_J2. We can automatically handle the preview_ prefix if we find a _preX suffix in the edition string, for example with optifine:1.21.4:HD_U_J3_pre9.

Tell we what do you think.

many fixes, bring support for optifine search and installation in the CLI, use regex for version resolve
@pi-dev500
Copy link
Author

I mean, the directory name used to store the version in the version directory. To start Optifine, I already support this format, but also several others thanks to regex (I saw that regex are well-supported by rust). I currently have both, the name used by sp614x, and the prefix system that is used in ForgeVersion and FabricVersion. I don't really know which one I have to keep.

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