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
Major refactor to Java launcher library #291
Major refactor to Java launcher library #291
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this creates a few new warnings:
org/prismlauncher/impl/OneSixLauncher.java:63: warning: [unchecked] unchecked method invocation: method allSafe in class Parameters is applied to given types
mcParams = params.allSafe("param", Collections.EMPTY_LIST);
^
required: String,List<String>
found: String,List
org/prismlauncher/impl/OneSixLauncher.java:63: warning: [unchecked] unchecked conversion
mcParams = params.allSafe("param", Collections.EMPTY_LIST);
^
required: List<String>
found: List
org/prismlauncher/impl/OneSixLauncher.java:63: warning: [unchecked] unchecked conversion
mcParams = params.allSafe("param", Collections.EMPTY_LIST);
^
required: List<String>
found: List
org/prismlauncher/impl/OneSixLauncher.java:66: warning: [unchecked] unchecked method invocation: method allSafe in class Parameters is applied to given types
traits = params.allSafe("traits", Collections.EMPTY_LIST);
^
required: String,List<String>
found: String,List
org/prismlauncher/impl/OneSixLauncher.java:66: warning: [unchecked] unchecked conversion
traits = params.allSafe("traits", Collections.EMPTY_LIST);
^
required: List<String>
found: List
org/prismlauncher/impl/OneSixLauncher.java:66: warning: [unchecked] unchecked conversion
traits = params.allSafe("traits", Collections.EMPTY_LIST);
^
required: List<String>
found: List
they should probably be fixed, even if it incurs in some performance overhead. this isn't exactly a hot path anyways :3
I have fixed this now. Even if the performance impact is nothing to lose sleep about (well, it is for me), it's still generally preferred to use emptyList when you want an immutable empty list. Fortunately I managed to keep using this method in a safer way. Anyway, does anyone have any idea of what I should change with the license headers, if anything? |
|
Old versions of Minecraft used Java applets so they could be run in web browsers. I think there is a standalone main class though. However, since there are other compatibility issues with newer versions of Java, I can't see many reasons to replace it. |
Perhaps it might be better to split the applet/legacy launcher and the default launcher into separate classes? There already exists support for different launcher types, so why not use it? That way you can |
Also, in the line of some improvements to the java code, why not use the
|
Okay, I will try to improve the code more - maybe more of a refactor. I was trying to avoid it because other projects (it was mainly one though) didn't like it when I kept adding to my pull requests. Time to fire up an IDE that isn't totally terrible ;) |
Take your time and make your changes. We won't merge it until it's deemed ready. |
1400126
to
41a1926
Compare
I was gonna make my own pr with a bunch of code cleanup changes later as well, bc I noticed quite a few things that could be changed |
I think I've done enough for this pull request. I've implemented #291 (comment), as well as replaced some string splitting with substringing (just personal preference, but I think it's best to avoid regex when searching for single characters - and it can have side-effects if the character appears more times than you want). Maybe I'll open one aimed at improving the legacy launcher. Also, somebody's been here before. I reverted the change only for one of the fields which is changed. No idea why re-requesting a review removed txtsd's. |
few things I just noticed:
Also, I'd very much like to contribute some of my own changes to this, but I want to commit them myself, so they're under my name (As they're slightly more significant than the previous changes I suggested). Would that be possible? If so, how do you want me to do that? I could make a fork of your fork, then PR to it, so that way it can be merged into this branch. |
Oh dear, this is getting confusing. I'll give you push access. I'm not sure if people normally do that, but since you're not part of the Prism Launcher organisation it would be that or a fork fork (and this repo is already a fork fork). |
👍 alright
|
We used to use emptyList() for everything but some lists can be modified conditionally so it should actually all be mutable. EDIT: nvm you already saw my commit :D |
cc0c920
to
b84845f
Compare
@TheKodeToad I was going to keep You alright if I revert that commit later? |
Also, avoid force pushes if possible, because it forces me to have to rebase/re-clone my entire branch |
It seems weird to couple a class with a utils one. I feel like it would be more logical to move some of the messy logic into other methods.
Oops, sorry. I had to because I forgot signing off. I think I've got the hang of it now. Edit: OMG I keep pushing and then realising my mistake. Still, it shouldn't make a difference unless you already have the commits on your local copy - rebasing is normally required even without force pushing. |
e3deb2c
to
bedc30e
Compare
If you want to make sure to sign every single commit, add the following to your
Then, it will sign every single one of your commits by default (so you don't need to specify |
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Factories in OOP are a classic example of over-enginneering. When you only have two launchers I personally think that it's not very useful. Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Passing the classpath into stdin has no effect. Java is already provided the classpath with -cp, which pretty much takes up the largest part of the arguments anyway, which leads me to wonder, what's the point of stdin arguments at all? Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
bd310b5
to
5e3a1ce
Compare
I have managed to squash and drop a lot of commits. It should be ready for review now. The code is at a stage where to see something wrong with it you'd have to be not me. |
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
5e3a1ce
to
54f7048
Compare
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
54f7048
to
32c2ad2
Compare
libraries/launcher/org/prismlauncher/utils/logging/LogPrintStream.java
Outdated
Show resolved
Hide resolved
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
solonovamax helped a lot with this. Thank you!
Changes:
onesix
launcher intostandard
andlegacy
(Standard, Legacy and AbstractLauncher were introduced).