Jump to content

[SOLVED] [1.15.1] Crash during mod loading of custom command - TLDR: don't forget to reObfJar and use correct .jar file


wasEnabled

Recommended Posts

I can run the mod via "runClient" and "runServer" but as soon as I build a jar and copy the .jar file from ./build/libs/ into either a Forge 1.15.1 client or server I get a "NoSuchMethod" error crash report (see below).

 

My read of the crash report is that my "register" method is improperly formed somehow... but I can't reconcile why it works with "runClient" and "runServer" in IntelliJ but not as a .jar file where it fails on both client and server with the same "NoSuchMethodError".  I suspect this is a versioning issue somewhere but I'm at a loss for what to test or change.  Is this related to the "mappings" in build.gradle, for example, currently I'm using the default:

 

mappings channel: 'snapshot', version: '20190719-1.14.3'

 

Crash report:

Quote

 

Time: 11/01/20 12:16 AM
Description: Exception in server tick loop

java.lang.NoSuchMethodError: net.minecraft.command.Commands.literal(Ljava/lang/String;)Lcom/mojang/brigadier/builder/LiteralArgumentBuilder;
    at com.xmodus.JustFileAPI.commands.ModCommands.register(ModCommands.java:24) ~[?:1.0] {re:classloading}
    at com.xmodus.JustFileAPI.setup.ForgeEventHandlers.serverLoad(ForgeEventHandlers.java:19) ~[?:1.0] {re:classloading}
    at net.minecraftforge.eventbus.ASMEventHandler_7_ForgeEventHandlers_serverLoad_FMLServerStartingEvent.invoke(.dynamic) ~[?:?] {}
    at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(ServerLifecycleHooks.java:89) ~[?:?] {re:classloading}
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:241) ~[?:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:610) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
    Minecraft Version: 1.15.1
    Minecraft Version ID: 1.15.1
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_222, AdoptOpenJDK
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), 
    Memory: 509258888 bytes (485 MB) / 1779957760 bytes (1697 MB) up to 3817865216 bytes (3641 MB)
    CPUs: 12
    JVM Flags: 1 total; -Xmx4096m
    ModLauncher: 5.0.0-milestone.4+67+b1a340b
    ModLauncher launch target: fmlserver
    ModLauncher naming: srg
    ModLauncher services: 
        /eventbus-2.0.0-milestone.1-service.jar eventbus PLUGINSERVICE 
        /forge-1.15.1-30.0.36.jar object_holder_definalize PLUGINSERVICE 
        /forge-1.15.1-30.0.36.jar runtime_enum_extender PLUGINSERVICE 
        /accesstransformers-2.0.0-milestone.1-shadowed.jar accesstransformer PLUGINSERVICE 
        /forge-1.15.1-30.0.36.jar capability_inject_definalize PLUGINSERVICE 
        /forge-1.15.1-30.0.36.jar runtimedistcleaner PLUGINSERVICE 
        /forge-1.15.1-30.0.36.jar fml TRANSFORMATIONSERVICE 
    FML: 30.0
    Forge: net.minecraftforge:30.0.36
    FML Language Providers: 
        javafml@30.0
        minecraft@1
    Mod List: 
        forge-1.15.1-30.0.36-server.jar Minecraft {minecraft@1.15.1 DONE}
        justfileapi-1.0.jar JustFile Mod {justfileapi@1.0 DONE}
        forge-1.15.1-30.0.36-universal.jar Forge {forge@30.0.36 DONE}
    Player Count: 0 / 20; []
    Data Packs: vanilla, mod:forge (incompatible), mod:justfileapi (incompatible)
    Is Modded: Definitely; Server brand changed to 'forge'
    Type: Dedicated Server (map_server.txt)

 

Github link to project:https://github.com/xmoduslearning/JustFileAPI

 

Edited by wasEnabled
solved
Link to comment
Share on other sites

You need to run the build task, this reobfuscates the built JAR so it can be loaded outside of the development environment.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

** SOLVED **

 

Thank-you Ommina, yes, it was the "reObfJar" task that was missing.  Once I ran the "reObfJar", under Tasks > other >reobfJar and checked the ./build/reobfJar/ folder I discovered an "output.jar" file.  I renamed that to my mod name, placed it in the the mod folder and it worked.

 

For anyone else who mistakenly takes the .jar from the /build/libs folder without first re-obfuscating it then you may encounter a mismatch between the libraries like I did.

Link to comment
Share on other sites

So, to clarify, for anyone else who finds this post.  What I was doing incorrectly was that was using Tasks > build > build but I was taking the .jar file from my /build/libs folder, which is named after my modid (so in my case it's named justfileapi-1.0.jar), but this is a pre-re-obfuscated version of the jar.  In the /builds/reobfJar/ folder however there is an "output.jar" file which is my re-obfuscated .jar file -- this is the final version which I manually renamed and deployed.

Link to comment
Share on other sites

3 hours ago, wasEnabled said:

So, to clarify, for anyone else who finds this post.  What I was doing incorrectly was that was using Tasks > build > build but I was taking the .jar file from my /build/libs folder, which is named after my modid (so in my case it's named justfileapi-1.0.jar), but this is a pre-re-obfuscated version of the jar.  In the /builds/reobfJar/ folder however there is an "output.jar" file which is my re-obfuscated .jar file -- this is the final version which I manually renamed and deployed.

 

The JAR in the build/libs directory is the correct one, you just need to run build instead of jar. You don't need to use anything from any of the other directories in build, they only contain temporary/intermediate files.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks Choonster, I thought I was going crazy with sometimes the .jar in the builds/libs working and other times not.  I verified that all I need to do is run the Tasks > build > build and then obtain the correctly named .jar from the build/libs folder.

 

I had mistakenly assumed that I needed to run the Tasks > build > jar to generate a release .jar file, but that was incorrect and only created a non reObfJar file because it was skipping the reObfJar step.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.