Pierce01 / MinecraftLauncher-core

Lightweight module that downloads and runs Minecraft using javascript / NodeJS
MIT License
362 stars 82 forks source link

1.7.X forge guava library issue #126

Open dooji2 opened 5 months ago

dooji2 commented 5 months ago

It seems that all 1.7 forge versions crash, unless the guava library is removed from the /versions/version.json, specifically:

        {
            "downloads": {
                "artifact": {
                    "path": "com/google/guava/guava/15.0/guava-15.0.jar",
                    "sha1": "ed727a8d9f247e2050281cb083f1c77b09dcb5cd",
                    "size": 2172168,
                    "url": "https://libraries.minecraft.net/com/google/guava/guava/15.0/guava-15.0.jar"
                }
            },
            "name": "com.google.guava:guava:15.0"
        },

Not sure if I'm doing something wrong, but it's just using the .json that was generated for Forge by MCLC. I'm also not too sure if removing this library would cause issues, but it seems to be fine. If it shouldn't be there I assume one could skip it in the downloadToDirectory function in handler.js, but again I could be wrong.

Any help is appreciated, thanks!

PadowYT2 commented 5 months ago

I don't think there's something MCLC can do. MCLC gets the version.json from the version itself, modifying nothing

Pierce01 commented 5 months ago

I'm traveling abroad so I'll be able to debug on my end once I get back (26th). In the meantime, could you post the stack trace that's being returned when Minecraft crashes?

dooji2 commented 5 months ago

Yep here it is

[20:24:05] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

App.js:320 [20:24:05] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

App.js:320 Exception in thread "main" 
App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.NoSuchMethodError: com.google.common.io.CharSource.readLines(Lcom/google/common/io/LineProcessor;)Ljava/lang/Object;

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at cpw.mods.fml.common.asm.transformers.AccessTransformer.processATFile(AccessTransformer.java:125)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at cpw.mods.fml.common.asm.transformers.AccessTransformer.readMapFile(AccessTransformer.java:120)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at cpw.mods.fml.common.asm.transformers.AccessTransformer.<init>(AccessTransformer.java:101)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at cpw.mods.fml.common.asm.transformers.AccessTransformer.<init>(AccessTransformer.java:97)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at java.lang.Class.newInstance(Class.java:442)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at net.minecraft.launchwrapper.LaunchClassLoader.registerTransformer(LaunchClassLoader.java:88)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at cpw.mods.fml.common.launcher.FMLDeobfTweaker.injectIntoClassLoader(FMLDeobfTweaker.java:32)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at net.minecraft.launchwrapper.Launch.launch(Launch.java:115)

App.js:320 [20:24:05] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]:    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

App.js:323 Minecraft process exited with code 1
CERcoding commented 4 months ago

Not sure if its related but I am having a similar issue with fresh vanilla 1.7.x versions being completely unable to launch.

Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1
        at com.google.gson.Gson.fromJson(Gson.java:815)
        at com.google.gson.Gson.fromJson(Gson.java:768)

        at com.google.gson.Gson.fromJson(Gson.java:717)
        at net.minecraft.client.main.Main.main(SourceFile:120)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:374)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
        at com.google.gson.Gson.fromJson(Gson.java:803)
        ... 3 more
CERcoding commented 4 months ago

Well, I found the fix for my issue. In the handler, getLaunchOptions() does args = args.filter(value => typeof value === 'string' || typeof value === 'number') just before returning. this removes arg user_properties value {} which seems to be a required argument for 1.7 minecraft versions. I quickly fixed it by changing the filter to: args = args.map(value => typeof value === 'object' ? JSON.stringify(value) : value)

this is just a quick fix and not very deeply looked into. I tested some other versions and it seems to be fine. There still might be some nuances I am missing.

If this helps with OPs issue then great, if not, still something to take note of in my opinion.

dooji2 commented 4 months ago

Unfortunately that didn't help :(, although oddly in my case vanilla 1.7.X works fine for me out-of-the-box. Interesting enough, it seems that replacing the guava-15.0.jar with guava-17.0.jar and renaming it to guava-15.0.jar results in a successful launch

w01f-o commented 1 month ago

I had the same problem. The solution above with guava replacement helped